Using private GitHub packages with netlify

I am in a bit of a pickle trying to host a site from GitHub. The issue is that it uses a private package from GitHub Packages. So, in my .npmrc file I have:

//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
registry=https://npm.pkg.github.com/orgName/

and in env variables I have GITHUB_TOKEN pointing to a token that has repo, write:packages, read:packages, delete:packages permissions set. Alas, for netlify I get instead:

11:49:32 AM: code E401
11:49:32 AM: npm ERR!
11:49:32 AM:  Unable to authenticate, need: Basic realm="GitHub Package Registry"
11:49:32 AM: npm

This error I encountered before on my local machine when I didn’t have .npmrc file at all. Is it possible that the file isn’t read? I’m positive that it’s being pushed to github. The site is festive-dubinsky-4a70dd.

Hi @msadowski, have you checked out this post: [Common Issue] Using private NPM modules on Netlify? That goes into some details on using private NPM modules.

Sorry for coming back so late, but maybe for future reference - Everything was right EXCEPT for the trailing slash, simple typo that slipped during some trials. Sorry for bothering you!

1 Like

glad it’s working now, @msadowski!