I have published a package to the GitHub npm registry. I can see the package when I login onto GitHub, as per the screenshots below.
Locally, a different package has the former as a dependency. Therefore I have on my package.json
:
"dependencies": {
"<@scope>/<package_name>": "1.2.0",
...
I also have, in-line with the documentation, a .npmrc
file at the same directory as the package.json
with the authToken. This authToken has all the permissions necessary (delete:packages, read:packages, repo, write:packages
)
//npm.pkg.github.com/:_authToken=<my_auth_token>
registry=https://npm.pkg.github.com/OWNER
Lastly, I have on package.json
the following two entries. Although I believe these are necessary to publish packages to the github registry, no to install them which is the current problem.
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"repository": {
"type": "git",
"url": "https://github.com/<OWNER>/<REPO>.git"
}
So, the error that I am having when I try to install the package is:
npm ERR! code E404
npm ERR! 404 Not Found: <@scope>/<package_name>@1.2.0
When I tried to understand what was going on with some helpful logs:
With npm install @<scope>/<package_name>@1.2.0 --loglevels verbose
, I see:
....
npm http fetch GET 200 https://npm.pkg.github.com/OWNER/@<scope>%2f<package_name>
npm http fetch GET 404 https://npm.pkg.github.com/download/@<scope>/<package_name>/1.2.0/98e69e2adddec5c715a32c94352efac83ce586e4e6f3d06fef1fc1f82d238r34
...
The first http request is a success, which seems to indicate things are correctly wired up and authenticated. However, I have no idea why I am getting a 404 afterwards. The package is clearly there as we see on the image above.
Does anyone had a similar problem ?
npm info @scope/name
it works fine, but it's the install step that fails. It happens both with yarn and npm client.