Fix: npm ERR! code E404 – Not Found (package not found in registry)
Quick Answer
How to fix npm ERR code E404 not found error caused by typos, private registries, scoped packages, deleted packages, and authentication issues.
The Error
You run npm install and get:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/my-package - Not found
npm ERR! 404
npm ERR! 404 'my-package@latest' is not in this registry.Or variations:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@myorg%2fmy-package - Not foundnpm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/my-package - Not foundnpm ERR! code E404
npm ERR! 404 '@myorg/my-package@^2.0.0' is not in the npm registry.npm cannot find the package in the registry. The package name does not exist, is misspelled, has been unpublished, or the registry configuration is wrong.
Why This Happens
When you run npm install my-package, npm sends a request to the configured registry (default: https://registry.npmjs.org/) to fetch the package metadata. A 404 response means the registry does not have a package with that name.
Common causes:
- Package name typo.
expresinstead ofexpress,loashinstead oflodash. - Package was unpublished or removed. The author removed it from the registry.
- Scoped package with wrong scope.
@wrong-org/packageinstead of@correct-org/package. - Private package without authentication. You need to be logged in to access private packages.
- Wrong registry configured. Your
.npmrcpoints to a private registry that does not have the package. - Package renamed. The package was renamed and the old name is no longer available.
- Publishing a scoped package without access. You try to publish
@myorg/pkgbut the organization does not exist or you do not have permission.
Fix 1: Check the Package Name for Typos
The most common cause. Verify the exact package name:
# Search for the package on npm
npm search my-package
# Or check directly on the npm website
# https://www.npmjs.com/package/my-packageCommon typos:
| Wrong | Correct |
|---|---|
expres | express |
loash | lodash |
axois | axios |
react-router-v6 | react-router |
@types/reac | @types/react |
babel-core | @babel/core (scoped since v7) |
eslint-plugin-react-hook | eslint-plugin-react-hooks |
Check your package.json:
# Look for the problematic package
cat package.json | grep -i "the-package-name"Fix the typo and run npm install again.
Pro Tip: If you are not sure about a package name, search for it with
npm search <keyword>or browse npmjs.com. Partial name searches work:npm search react routerfindsreact-routerand related packages.
Fix 2: Check if the Package Was Renamed or Moved
Many popular packages have been renamed or moved to scoped packages:
# Old name → New name (scoped)
babel-core → @babel/core
babel-preset-env → @babel/preset-env
eslint-plugin-node → eslint-plugin-n
webpack-cli → @webpack-cli/serve (partially)
# Check if the old name has a deprecation message
npm view babel-corenpm will often show a deprecation notice:
npm WARN deprecated babel-core@6.26.3: babel-core has been renamed to @babel/coreFix: Update to the new package name:
npm uninstall babel-core
npm install @babel/coreFix 3: Fix Registry Configuration
Your npm might be configured to use a private registry that does not have the package:
Check your current registry:
npm config get registryThe default is https://registry.npmjs.org/.
Check for .npmrc files:
# Project-level .npmrc
cat .npmrc
# User-level .npmrc
cat ~/.npmrc
# Global .npmrc
npm config list -l | grep registryIf a private registry is configured:
# .npmrc pointing to a private registry
registry=https://npm.mycompany.com/
# This means ALL packages are fetched from the private registry
# If your private registry doesn't proxy npmjs.org, public packages return 404Fix: Use scoped registries instead of overriding the default:
# .npmrc — only route @myorg packages to the private registry
@myorg:registry=https://npm.mycompany.com/
# All other packages use the default npmjs.org registryFix: Reset to the default registry:
npm config set registry https://registry.npmjs.org/Fix 4: Fix Scoped Package Access
Scoped packages (@org/package) have special access rules:
Public scoped packages:
# These should work without authentication
npm install @angular/core
npm install @types/nodePrivate scoped packages:
# You must be logged in
npm login
# Or use an auth token in .npmrc
//registry.npmjs.org/:_authToken=YOUR_TOKENOrganization packages:
# Check if you have access
npm access list packages @myorg
# If publishing a scoped package for the first time, it defaults to private
# Make it public:
npm publish --access publicCommon issue — wrong scope:
# Wrong: The organization name is case-sensitive
npm install @MyOrg/package # 404!
# Fixed: Use the correct case (usually lowercase)
npm install @myorg/packageCommon Mistake: Confusing npm organization names with GitHub organization names. They can be different. Check the package’s npm page for the exact scope name.
Fix 5: Fix Authentication for Private Packages
Private packages require authentication:
Log in to npm:
npm login
# Enter username, password, and emailUse an authentication token:
# In .npmrc
//registry.npmjs.org/:_authToken=${NPM_TOKEN}For GitHub Packages:
# .npmrc
@myorg:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}For CI/CD environments:
# GitHub Actions example
- name: Setup .npmrc
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- run: npm installCheck if your token is valid:
npm whoami
# Should print your username
# If it shows an error, your token is invalid or expiredFix 6: Fix Version-Specific 404
The package exists but the specific version does not:
npm ERR! 404 'lodash@99.0.0' is not in this registry.Check available versions:
npm view lodash versions --jsonFix: Use a valid version:
# Install the latest version
npm install lodash@latest
# Or a specific valid version
npm install lodash@4.17.21Check for pre-release tags:
npm view lodash dist-tags
# Shows: latest, next, beta, etc.
npm install lodash@next # Install the next versionFix lock file version conflicts:
# The lock file might reference a version that no longer exists
# Delete lock file and node_modules, then reinstall
rm package-lock.json
rm -rf node_modules
npm installFix 7: Fix Publishing 404 Errors
If you get 404 when publishing:
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@myorg/my-packageCheck if the organization exists:
# The organization must exist on npmjs.com
npm org ls myorgFor scoped packages, set the access level:
# Scoped packages default to restricted (private)
# If you don't have a paid account, publish as public
npm publish --access publicCheck your package.json name field:
{
"name": "@myorg/my-package",
"version": "1.0.0"
}The name must match an organization you have access to.
Check if the package name is taken:
npm view my-package
# If it shows package info, the name is takenFix 8: Handle Unpublished or Removed Packages
If a package was unpublished (rare but possible):
Check if the package ever existed:
npm view my-packageIf it was recently unpublished:
npm has a 72-hour window where packages can be unpublished. After that, the name is blocked for 24 hours. The package might come back.
Find an alternative:
# Search for similar packages
npm search keywords:similar-functionality
# Check if a fork exists
npm search my-package-forkUse a specific tarball or git URL as a workaround:
{
"dependencies": {
"my-package": "github:user/my-package#v1.0.0",
"other-package": "https://example.com/package-1.0.0.tgz"
}
}Still Not Working?
Check npm status. The registry might be experiencing issues:
# Check npm operational status
curl -I https://registry.npmjs.org/expressClear the npm cache:
npm cache clean --forceTry with verbose logging:
npm install my-package --verboseThis shows the exact URL npm is requesting, which helps identify registry or proxy issues.
Check for proxy/VPN interference. Corporate proxies might block or redirect npm registry requests:
npm config set proxy http://proxy.mycompany.com:8080
npm config set https-proxy http://proxy.mycompany.com:8080Check for DNS issues:
nslookup registry.npmjs.orgFor other npm errors, see Fix: npm ERR! ERESOLVE unable to resolve dependency tree. For permission errors when installing packages globally, see Fix: npm EACCES permission denied global install. For npm lifecycle errors, see Fix: npm ERR! code ELIFECYCLE.
Solo developer based in Japan. Every solution is cross-referenced with official documentation and tested before publishing.
Was this article helpful?
Related Articles
Fix: npm ERR! Could not resolve peer dependency conflict
How to fix the npm ERR! Could not resolve peer dependency conflict error. Covers --legacy-peer-deps, --force, npm overrides, peerDependenciesMeta, React version conflicts, and debugging with npm ls.
Fix: React Warning: Failed prop type
How to fix the React 'Warning: Failed prop type' error. Covers wrong prop types, missing required props, children type issues, shape and oneOf PropTypes, migrating to TypeScript, default props, and third-party component mismatches.
Fix: Express Cannot GET /route (404 Not Found)
How to fix Express.js Cannot GET route 404 error caused by wrong route paths, missing middleware, route order issues, static files, and router mounting problems.
Fix: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
How to fix the JavaScript heap out of memory error by increasing Node.js memory limits, fixing memory leaks, and optimizing builds in webpack, Vite, and Docker.