How to fix npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/package-name in npm
This error occurs when npm cannot find a package in the registry. Common causes include typos in the package name, incorrect registry configuration, or trying to access private/scoped packages without authentication.
Quick fix
Fixes E404
npm search package-name- Verify the package name is spelled correctly
- Check your registry configuration
- Clear npm cache
- Handle scoped/private packages
npm search package-namenpm ERR! code E404npm ERR! 404 Not Found - GET https://registry.npmjs.org/package-name
What this error means
The E404 error in npm indicates that the npm registry returned a 404 HTTP status code, meaning the requested package could not be found at the specified URL. This is one of the most common npm errors developers encounter. When you run `npm install package-name`, npm sends a GET request to the registry (by default https://registry.npmjs.org/) to fetch the package metadata. If the registry responds with 404 Not Found, npm reports this error with the exact URL it tried to access. This error can occur for several reasons: the package name is misspelled, the package has been unpublished, you're using a corporate proxy that doesn't have the package, or you're trying to install a scoped package (like `@organization/package`) without proper authentication. Understanding the URL in the error message is key to diagnosing the issue.
Typical symptoms
- npm install fails with 'npm ERR! code E404' and '404 Not Found'
- The error message shows the full registry URL that returned 404
- Error appears for specific packages but others install fine
- CI/CD pipelines fail during dependency installation
- Error occurs after switching networks or using VPN
Common causes
- Typo in the package name (most common) - e.g., 'lodahs' instead of 'lodash'
- Package has been unpublished or deprecated from the npm registry
- Incorrect registry URL configured in .npmrc or npm config
- Corporate proxy or VPN blocking access to the npm registry
- Trying to install a private/scoped package without authentication
- Local .npmrc file overriding the global registry configuration
- Stale npm cache containing outdated package references
How to fix "npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/package-name"
First, confirm the package exists on npm by searching for it:
npm search package-nameOr visit https://www.npmjs.com/package/package-name in your browser.
Common typos to check:
- Transposed letters: lodash vs lodash
- Missing hyphens: createreactapp vs create-react-app
- Wrong scope: @angular/cli vs angular-cli
If you're using npx, check the command too:
# Wrong
npx crate-react-app my-app
# Correct
npx create-react-app my-appVerify which registry npm is using:
npm config get registryThe default should be https://registry.npmjs.org/. If it shows a different URL (like a corporate proxy), that may be the issue.
Reset to the default registry:
npm config set registry https://registry.npmjs.org/Also check for local .npmrc files that might override this:
# Check project directory
cat .npmrc
# Check home directory
cat ~/.npmrcA corrupted or stale cache can cause 404 errors. Clear it with:
npm cache clean --forceThen verify the cache is clean:
npm cache verifyAfter clearing the cache, try the install again:
npm installIf the error is for a scoped package (starting with @), you may need to authenticate.
For npm private packages:
npm loginFor GitHub Packages:
Create a .npmrc file with:
@OWNER:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_TOKENFor organization packages:
Ensure you have access to the organization and are logged in:
npm whoami
npm org ls your-orgNetwork issues can cause 404 errors. Test your connection:
# Test direct access to npm registry
curl -I https://registry.npmjs.org/
# Test a specific package
curl https://registry.npmjs.org/lodashIf you're behind a corporate proxy or VPN:
1. Try disconnecting from VPN temporarily
2. Configure npm to use your proxy:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080Or use HTTP instead of HTTPS (less secure, for troubleshooting only):
npm config set registry http://registry.npmjs.org/An outdated npm version can sometimes cause registry issues:
npm install -g npm@latestOr if using Node.js with nvm:
nvm install-latest-npmVerify the update:
npm --versionAdvanced notes
### Debugging Registry Requests
To see exactly what npm is doing, use the verbose flag:
npm install package-name --verboseThis shows the full HTTP request/response cycle, helping identify where the 404 originates.
### Corporate Registry/Proxy Issues
Many organizations use npm Enterprise, Artifactory, or Verdaccio as private registries. These proxies cache public packages but may not support:
- Newer packages (not yet cached)
- Scoped packages (requires configuration)
- Organization features
Work with your IT team to ensure the proxy is properly configured to forward requests to the public registry.
### Package Unpublishing
npm allows unpublishing packages within 72 hours of publishing. After that, packages cannot be easily unpublished. If you're seeing 404 for a package that previously existed:
1. Check if it was renamed (common with acquisitions)
2. Look for a deprecation notice on npmjs.com
3. Search for alternatives using npm search
### CI/CD Specific Issues
In CI/CD environments, 404 errors often occur due to:
1. Race conditions: Installing a package that was just published but not yet propagated
2. Token expiration: npm tokens have limited lifetimes
3. Network restrictions: CI runners may not have access to all registries
For CI, consider:
- Using npm ci instead of npm install for reproducible builds
- Caching node_modules between builds
- Setting up a local registry mirror
### Package-lock.json Conflicts
If your package-lock.json references a version that no longer exists:
# Remove lock file and node_modules
rm -rf node_modules package-lock.json
# Fresh install
npm installThis regenerates the lock file with currently available versions.
Frequently asked questions
- What does "E404" mean?
- The E404 error in npm indicates that the npm registry returned a 404 HTTP status code, meaning the requested package could not be found at the specified URL. This is one of the most common npm errors developers encounter. org/) to fetch the package metadata.
- How do I fix "E404"?
- This error occurs when npm cannot find a package in the registry. Common causes include typos in the package name, incorrect registry configuration, or trying to access private/scoped packages without authentication.
- What causes "E404"?
- Typo in the package name (most common) - e.g., 'lodahs' instead of 'lodash' Package has been unpublished or deprecated from the npm registry Incorrect registry URL configured in .npmrc or npm config
- Is the "E404" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐npm Official Documentation
- ๐ฌInstalling npm package fails with 404 - Stack Overflow(Stack Overflow)
- ๐ฌnpm ERR! 404 Not Found - Stack Overflow(Stack Overflow)
- ๐
- ๐
- ๐