Fix it fast
Most likely: The package name, version, tag, scope, or registry mapping does not point to a package that exists in the registry npm is using.
1. Confirm this is your error
npm ERR! code E404
npm ERR! 404 Not Found: @angular/cli@latest 2. Check the cause
npm config get registry
npm view <package> --registry <registry>
npm view <package>@<version> --registry <registry>
npm config list -l 3. Apply the safe fix
# Correct the package name, scope, version, or registry mapping.
npm view <package> versions --json --registry <registry>
# For scoped/private packages, make sure .npmrc routes the scope to the right registry.
@<scope>:registry=<registry-url>
npm install 4. Verify it works
npm view <package> --registry <registry>
npm install Don't use unsafe shortcuts
- Do not assume the package is public if it is scoped or private.
- Do not debug dependency resolution until
npm viewcan see the package metadata. - Do not forget
.npmrcprecedence, project, user, and global configs can point at different registries.
What npm Could Not Find
npm returned 404 because the package, version, scope, or registry URL does not exist at the registry you are using.
Check the exact package name, version, and source
Check which registry npm is using with npm config get registry, if the package is scoped, verify scope registry mapping in .npmrc (example: @your-scope:registry=...), and query the registry directly for metadata with npm view <pkg>@<version> --json.
Confirm the package version and source
Before you retry, confirm the exact name, version or tag, namespace, and index or registry this environment is supposed to use. Most fixes here are about pointing at the right thing.
Check which registry npm is using:npm config get registry
If the package is scoped, verify scope registry mapping in .npmrc (example: @your-scope:registry=...).
Check the exact package name and scope. Typos are the most common cause.
If it is a private package, confirm auth:npm whoami and verify .npmrc token config.
Retry with npm --verbose if the error message is truncated.
Why It Was Not Found
Usually this comes down to the configured registry does not contain the package/version you requested, auth is missing for a private registry or scoped package, or the requested version/tag/range is invalid or does not exist.
Prove the Source Resolves Correctly Now
Re-run npm view <pkg> for the same registry and confirm metadata is accessible, and re-run the original install and confirm the resolution error no longer appears.
How npm looks up package versions
npm resolves packages by fetching metadata from the registry, then selecting versions that satisfy semver ranges. Private registries and scopes add auth and routing requirements via .npmrc. If metadata lookup fails or no version satisfies constraints, npm throws a resolution error.
Avoid Version and Source Drift
To prevent this, keep registry config and auth in .npmrc under version control (where appropriate), pin versions (or use lockfiles) to avoid unexpected tag/range changes, and prefer a proxy/cache registry for CI stability.
Docs and source code
github.com/npm/cli/blob/417daa72b09c5129e7390cd12743ef31bf3ddb83/lib/commands/view.js
Open-source npm CLI code reference tied to this error code. - GitHub
const u = pckmnt.time.unpublished
throw Object.assign(new Error(`Unpublished on ${u.time}`), {
statusCode: 404,
code: 'E404',
pkgid: pckmnt._id,
})
}