How to fix npm ERR! code EREGISTRYMISSING npm ERR! Missing registry configuration in npm
This error occurs when npm cannot find or access the registry configured for a package, typically due to missing .npmrc configuration, incorrect registry URLs, or authentication issues. npm needs a valid registry URL to download packages.
Quick fix
Fixes npm ERR! code EREGISTRYMISSING npm ERR! Missing registry configuration
npm config list- Check your current npm registry configuration
- Set the default npm registry to the public registry
- Create or update your .npmrc file for scoped packages
- Clear npm cache and retry installation
npm config listnpm ERR! code EREGISTRYMISSINGnpm ERR! Missing registry configuration
What this error means
The EREGISTRYMISSING error means npm is unable to locate or connect to the package registry required to install a package. This commonly happens with scoped packages (like @mycompany/package-name) that require a custom private registry, but npm doesn't have the registry configuration in its .npmrc file. The error can also occur when the default npm registry URL is missing, corrupted, or unreachable. npm needs to know which registry server to contact to fetch package metadata and code. Without this configuration, npm cannot proceed with installation. For scoped packages, npm looks for a specific registry URL in the .npmrc file prefixed with the scope name.
Typical symptoms
- npm install fails immediately with EREGISTRYMISSING error before attempting to download any packages
- Error occurs specifically when installing scoped packages (e.g., @mycompany/package-name) but not with public packages
- Works in one environment but fails in another (e.g., local vs CI/CD pipeline)
- Error persists after updating package.json and package-lock.json is deleted
- Private packages show as 404 or cannot be found even though they exist in your registry
Common causes
- Missing .npmrc file in the project root or home directory with required registry configuration
- Scoped package registry not configured - the scope (@mycompany) is not associated with a private registry URL in .npmrc
- Incorrect .npmrc syntax - using @scope=url instead of @scope:registry=url
- .npmrc file in wrong location or with wrong file extension (e.g., .npmrc.txt on Windows)
- Default npm registry URL removed or corrupted from npm configuration
How to fix "npm ERR! code EREGISTRYMISSING npm ERR! Missing registry configuration"
First, verify what registry npm is currently configured to use:
npm config listLook for the registry line in the output. It should show something like:
registry = "https://registry.npmjs.org/"If you don't see a registry line or see an error, npm is missing registry configuration.
If the registry is missing or corrupted, set it back to the official npm registry:
npm config set registry https://registry.npmjs.org/For scoped packages that use a private registry, also configure the scope:
npm config set @mycompany:registry https://your-private-registry.com/Verify the configuration was set correctly:
npm config get registryFor projects using private registries, create a .npmrc file in your project root:
# For public packages from npm
registry=https://registry.npmjs.org/
# For scoped private packages
@mycompany:registry=https://your-private-registry.com/
# Authentication token for private registry
//your-private-registry.com/:_authToken=YOUR_AUTH_TOKEN_HEREIMPORTANT:
- File must be named exactly .npmrc (not .npmrc.txt)
- Use correct syntax: @scope:registry= not @scope=
- Auth tokens must be prefixed with // and include _authToken
After updating your registry configuration, clean the npm cache and attempt installation again:
npm cache clean --force
rm package-lock.json
rm -rf node_modules/
npm installOr specify the registry directly in the install command:
npm install --registry=https://registry.npmjs.org/If you're using a private registry, verify you're logged in and the registry is accessible:
npm login --registry=https://your-private-registry.com/ --scope=@mycompany
curl -H "Authorization: Bearer YOUR_TOKEN" https://your-private-registry.com/
npm cache verifyFor GitHub Packages, use a GitHub personal access token with read:packages permissions.
Advanced notes
On Windows, the .npmrc file must be created via command line or a code editor (not Windows Explorer) because Windows doesn't natively support files with only a dot prefix. A common mistake is the file being saved as .npmrc.txt instead. On macOS, TextEdit may save as .npmrc.rtf with garbage characters - use VSCode or command line instead. For CI/CD environments, pass credentials securely via environment variables rather than hardcoding tokens in .npmrc files.
Frequently asked questions
- What does "npm ERR! code EREGISTRYMISSING npm ERR! Missing registry configuration" mean?
- The EREGISTRYMISSING error means npm is unable to locate or connect to the package registry required to install a package. npmrc file. The error can also occur when the default npm registry URL is missing, corrupted, or unreachable.
- How do I fix "npm ERR! code EREGISTRYMISSING npm ERR! Missing registry configuration"?
- This error occurs when npm cannot find or access the registry configured for a package, typically due to missing .npmrc configuration, incorrect registry URLs, or authentication issues. npm needs a valid registry URL to download packages.
- What causes "npm ERR! code EREGISTRYMISSING npm ERR! Missing registry configuration"?
- Missing .npmrc file in the project root or home directory with required registry configuration Scoped package registry not configured - the scope (@mycompany) is not associated with a private registry URL in .npmrc Incorrect .npmrc syntax - using @scope=url instead of @scope:registry=url
- Is the "npm ERR! code EREGISTRYMISSING npm ERR! Missing registry configuration" 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
- ๐Docs: npm registry configuration(Official Docs)
- ๐ฌSO: npm registry issues(Stack Overflow)
- ๐GitHub: npm issues(GitHub)