How to use private npm packages on DO App Platform
I’m trying to run a Node.js app with private packages. These packages are hosted on GitHub packages. I created a personal access token and added a .npmrc file to my repository.
The token is provided my an environment variable.
When building the app on App Platform, I get this error:
backend | 12:18:10 Installing node_modules using yarn backend | 12:18:11 yarn install v1.22.10 backend | 12:18:11 [1/4] Resolving packages... backend | 12:18:11 error Couldn't find package "@my-org/my-package" on the "npm" registry. backend | 12:18:11 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. backend | 12:18:11 unable to invoke layer creator backend | 12:18:11 installing node_modules: exit status 1 backend | 12:18:11 ERROR: failed to build: exit status 1 backend | 12:18:11 ! Build failed (exit code 7)
Does App Platform not read the .npmrc file? Also why is it using yarn for installing the dependencies? I specifically avoided yarn because of problems with private GitHub packages.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×