Published a NPM package to Azure Artifacts but getting this error while installing

Viewed 2109

F:\angular library\sampleangular>npm install examplepackage@0.0.1 npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/examplepackage- Not found npm ERR! 404 npm ERR! 404 'examplepackage@0.0.1' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jack\AppData\Roaming\npm-cache_logs\2020-03-03T06_07_13_338Z-debug.log

2 Answers

We have the same error (E404). The root cause turned out, is because we have multiple registry sources. One is our own registry and the other is public registry (registry.npmjs.org)

To resolve this, we added both registries in the .npmrc file (can be in either user's .npmrc or the project .npmrc).

We append the following lines in the .npmrc file.

@contosoPrivateFeed:registry=https://contoso.pkgs.visualstudio.com/_packaging/Contoso.Feed/npm/registry/
registry=https://registry.npmjs.org

Also worth to mention, we don't have Upstream setup in our Azure DevOps feed. Specifying multiple registries allow npm commands to use the registries. Thus, no need to setup Upstream sources.

After some tests, we think your issue may be related to the UpStream source in Azure devops feed settings.

enter image description here

Here's some info when I do the test:

enter image description here

nest is package from default npm packages. When i deleted the npm upstream source, I got the same error when running command npm install nest. After that I added the NPM public source(npmjs) as one upstream sources in feed settings, then it worked when I ran the command the second time.

So you need to add npmjs as Upstream source of your current feed. Hope it helps :)

Related