The EREGISTRYNOTFOUND error occurs when npm cannot locate or connect to the configured package registry. This is typically caused by network connectivity issues, misconfigured registry URLs, or proxy settings blocking access.
This error indicates that npm failed to find the registry server specified in your configuration. When npm tries to fetch a package, it looks for the registry at the configured URL (by default https://registry.npmjs.org). If npm cannot resolve the hostname, reach the server, or the URL is incorrect, it throws EREGISTRYNOTFOUND. This can happen during 'npm install', 'npm publish', or other package operations. The root cause is almost always network-related—either your DNS cannot resolve the registry hostname, a proxy/firewall is blocking the connection, or the registry URL in your configuration is misconfigured.
Check what registry npm is currently pointing to. The default should be https://registry.npmjs.org/:
npm config get registryIf the output shows an incorrect or suspicious URL, you likely found the problem. Reset it to the official npm registry:
npm config set registry https://registry.npmjs.org/Look for .npmrc files in multiple locations that might have incorrect configurations:
cat ~/.npmrc
cat .npmrc
cat $(npm config get globalconfig)Look for typos or incorrect registry URLs. Common mistakes include:
- https://registry.npmjs.com (should be .org, not .com)
- Incorrect private registry URLs with missing protocol or domain
- Malformed scoped registry entries
Corrupted cache can sometimes cause registry lookup failures. Clear it aggressively:
npm cache clean --forceThen delete your lock file and node_modules, then try installing again:
rm -rf package-lock.json node_modules
npm installVerify that your system can resolve the registry hostname:
ping registry.npmjs.org
nslookup registry.npmjs.org
curl -v https://registry.npmjs.org/If DNS fails, try switching to Google's public DNS (8.8.8.8). On Linux/macOS, edit /etc/resolv.conf. On Windows, use Network Settings to change DNS.
If you're behind a corporate proxy, configure npm to use it:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080If your proxy requires authentication, include credentials in the URL (percent-encode special characters):
npm config set proxy http://username:[email protected]:8080Disconnect from any corporate VPN temporarily and try installing—if it works, the issue is proxy/VPN related.
For private registries (Verdaccio, Nexus, Artifactory, GitLab, etc.), the registry server must be running and accessible. If using scoped packages with private registries, ensure the scope in your package.json matches your .npmrc scope configuration. For example, if your package is @myorg/my-package, your .npmrc must have @myorg:registry=... configured. On Windows WSL, restarting the WSL terminal can resolve transient network issues. If all else fails, try the alternative Yarn registry: npm install --registry https://registry.yarnpkg.com to isolate whether the issue is npm-specific or registry-wide.
npm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
npm ERR! code EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code EMPTYPACKAGE npm ERR! Package contains no files
How to fix 'npm ERR! code EMPTYPACKAGE' - Package contains no files
npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: packages/missing
How to fix "npm ERR! code EWORKSPACEMISSING - Workspace does not exist" error
npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Address not available
How to fix "npm ERR! code EADDRNOTAVAIL - Address not available" error