I'm using Github Packages as my npm registry and have some private packages hosted there. I want all npm install requests to proxy through Github Packages. According to this blog post and these docs this should happen by default. However, when I run npm install
on my project, I get a package-lock.json
file that uses Github Packages registry for my custom private package, but the default npm registry for others.
Example snippet from package-lock.json
:
{
"name": "linting",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
"integrity": "sha512-8765asdf7865sadf+asdfsdfsdf/sfadsfg876675safsfsdfsdf678==",
"dev": true,
"requires": {
"@babel/highlight": "^7.10.4"
}
},
"@my-org/prettier-config": {
"version": "2.0.1",
"resolved": "https://npm.pkg.github.com/download/@my-org/prettier-config/2.0.1/sdg8765dsfg8675sdfg8765dsfg7685",
"integrity": "sha512-dsfgdfgdfgsdg56456ftg656h6h+sdfg876sdfg7865sdfg765675sdfg7865==",
"dev": true
}
}
}
I'm wondering whether my .npmrc
file is setup incorrectly. In the project root it looks like this:
registry=https://npm.pkg.github.com/my-org
And the .npmrc
in my home folder looks like this:
//npm.pkg.github.com/:_authToken=dsfg8765sdfg765dsfg685
Are my configs wrong, or is something else happening here that appears to be stopping the proxy?
Note all org names and keys changed to nonsense for the sake of this question.
Try adding a "/" to the end to make it like this registry=https://npm.pkg.github.com/my-org/