Search code examples
npmazure-devopsazure-artifactsnpm-publish

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


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


Solution

  • 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.