Skip to content

/errors/npm/e404-not-found

npm error code E404 404 Not Found - GET https://registry.npmjs.org/PACKAGE - Not found

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · 11.19.0updated
tool
npm
exit code
1
versions
npm 7 – 11
os
any

npm error code E404 ... 404 Not Found - GET https://registry.npmjs.org/PACKAGE - Not found means the registry npm asked has no package with that name, or will not show it to you. The URL in the message shows the registry and the exact name npm requested. Check the spelling first; for a private or scoped package, point the scope to the right registry in .npmrc and log in.

Reproduce it

bash
npm init -y >/dev/null
npm install --no-audit --no-fund errcodex-this-package-does-not-exist-xyz 2>&1 | grep -v "complete log"
exit "${PIPESTATUS[0]}"

Output · exit 1

npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/errcodex-this-package-does-not-exist-xyz - Not found
npm error 404
npm error 404  The requested resource 'errcodex-this-package-does-not-exist-xyz@*' could not be found or you do not have permission to access it.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.

The line The requested resource 'NAME@*' could not be found or you do not have permission to access it is deliberate: registries can answer 404 for private packages you are not allowed to read, so the message covers both cases.

Fix

Check that the name exists and which registry npm uses:

bash
npm view is-number@7.0.0 name version
npm config get registry

Output

name = 'is-number'
version = '7.0.0'
https://registry.npmjs.org/

For a scoped package on a private registry, add this to the project .npmrc (replace the scope and URL):

.npmrc
@company:registry=https://npm.company.example/

Then authenticate once with npm login --registry=https://npm.company.example/ --scope=@company. In CI, store the token as a secret and reference it from .npmrc through an environment variable instead of committing it.

Sources