I do code and games and stuffs
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.
@my-org:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @Salzian!
If a yarn.lock file exists, App Platform will use Yarn. Otherwise, if a package-lock.json file exists, it will use NPM. It seems like Yarn doesn’t read .npmrc files, so that’s why it’s failing trying to pull your private package.
Hey @Salzian I ran into the same issue and what I ended up doing (since the offending package was a Dockerized server) was ensure that I copied all shared packages to the Docker file. That worked for me.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.