Install node package from private Github packages repo

I have a private library built and published to the private Github packages registry, I was expecting to be able to specify a npmrc with my scoped registry and auth like this;


but if I use .npmrc with a yarn.lock in the project it errors with,

‘Warning: a .npmrc file was found. yarn does not read .npmrc files, use .yarnrc instead if needed.’

So I tried making a .yarnrc file and that just got me a 401 response, and I also tried a .yarnrc.yml and that also got me a 401.

I cant see another question with this answered and my project depends on being able to install this package

Submit an answer

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!

Sign In or Sign Up to Answer

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.


I have also been struggling with this. To be clear, this is not talking about building from a private github repo that @alexdo is referring to, rather a npm package repository.

I have had success in switching to using npm, rather than yarn, to install. However this is not ideal as we prefer to use yarn in our workflows.

I have yet to find a way to successfully use yarn. It is remarkably frustrating. One solution might be, to use yarn locally, but npm in the build process. I’m going to look into .gitignore the yarn.lock file, and include a hook to use

npm i --package-lock-only

To generate a package.lock file for the build process to use npm.

Site Moderator
Site Moderator badge
December 16, 2022

Hello @klewin23

In order to build from private repositories you need to have the right permissions.

To run through the Github auth process again you can visit

If you have multiple orgs associated with your Github account, be sure to choose the org that your private repo is in.

Then on the Repository Access screen, either choose “All Repositories” or specifically select the now-private repo you want to deploy.


Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up