The ENOREGISTRY error occurs when npm cannot find or access a configured package registry. This typically happens when the registry configuration is missing, misconfigured, or inaccessible due to network issues or missing authentication.
npm requires a registry URL to download packages. This error appears when npm's configuration lacks a valid registry setting or cannot reach the specified registry server. The registry is the central repository where npm packages are stored and retrieved from.
Run this command to see what registry npm is currently configured to use:
npm config get registryIf the output is empty or shows an invalid URL, your registry is not properly set.
Set npm to use the official public registry:
npm config set registry https://registry.npmjs.org/Verify it was set correctly:
npm config get registry
# Should output: https://registry.npmjs.org/Locate your .npmrc files at ~/.npmrc (global) or in your project root.
Ensure it contains a valid registry line:
registry=https://registry.npmjs.org/On Windows, verify the file encoding is UTF-8, not UCS-2 LE BOM.
Clear any corrupted cache files:
npm cache clean --force
rm -rf node_modules package-lock.json
npm installEnsure you can reach the registry server:
curl https://registry.npmjs.org/If behind a proxy, configure npm to use it:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080The ENOREGISTRY error is relatively rare in modern npm (v6+) because npm defaults to the public registry if no configuration is found. This error typically appears in fresh installations, Docker containers, or CI/CD environments where the .npmrc file is missing or incorrectly configured. For monorepos using pnpm or yarn, check their respective configuration files.
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