How to fix npm ERR! code ENOREGISTRY npm ERR! No registry specified in npm
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.
Quick fix
Fixes ENOREGISTRY
npm config get registry- Check your current registry configuration
- Reset the registry to the default npm public registry
- Check and fix your .npmrc file
- Clear npm cache and reinstall dependencies
npm config get registrynpm ERR! code ENOREGISTRYnpm ERR! No registry specified
What this error means
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.
Typical symptoms
- npm install, npm ci, or npm publish commands fail immediately
- Error message displays: 'npm ERR! code ENOREGISTRY' or 'npm ERR! No registry specified'
- Network requests to registry URLs timeout or hang
- Fresh Node.js installations fail to install any packages
- Scoped packages (@org/package) cannot be resolved
Common causes
- Registry configuration is missing from global or project .npmrc files
- The .npmrc file contains incorrect syntax or an invalid registry URL
- The .npmrc file has encoding issues (Windows: UCS-2 LE BOM instead of UTF-8)
- Network connectivity or DNS issues prevent reaching the registry
- Corporate proxy or firewall is blocking access to registry.npmjs.org
- Scoped packages point to a custom registry that is not configured
How to fix "npm ERR! code ENOREGISTRY npm ERR! No registry specified"
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:8080Advanced notes
The 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.
Frequently asked questions
- What does "ENOREGISTRY" mean?
- 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.
- How do I fix "ENOREGISTRY"?
- 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.
- What causes "ENOREGISTRY"?
- Registry configuration is missing from global or project .npmrc files The .npmrc file contains incorrect syntax or an invalid registry URL The .npmrc file has encoding issues (Windows: UCS-2 LE BOM instead of UTF-8)
- Is the "ENOREGISTRY" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐npm Official Documentation
- ๐npm Docs: Registry Configuration(Official Docs)
- ๐npm Docs: .npmrc Configuration(Official Docs)
- ๐ฌStack Overflow: npm Registry Configuration(Stack Overflow)