How to fix npm ERR! code ENOREGISTRY npm ERR! No registry specified in npm

npmBEGINNERHIGHUpdated Dec 3, 2025ยท 146 views

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
  1. Check your current registry configuration
  2. Reset the registry to the default npm public registry
  3. Check and fix your .npmrc file
  4. Clear npm cache and reinstall dependencies
npm โ€” error
npm config get registry
npm ERR! code ENOREGISTRY
npm 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

  1. Registry configuration is missing from global or project .npmrc files
  2. The .npmrc file contains incorrect syntax or an invalid registry URL
  3. The .npmrc file has encoding issues (Windows: UCS-2 LE BOM instead of UTF-8)
  4. Network connectivity or DNS issues prevent reaching the registry
  5. Corporate proxy or firewall is blocking access to registry.npmjs.org
  6. Scoped packages point to a custom registry that is not configured

How to fix "npm ERR! code ENOREGISTRY npm ERR! No registry specified"

1Check your current registry configuration

Run this command to see what registry npm is currently configured to use:

bash
npm config get registry

If the output is empty or shows an invalid URL, your registry is not properly set.

2Reset the registry to the default npm public registry

Set npm to use the official public registry:

bash
npm config set registry https://registry.npmjs.org/

Verify it was set correctly:

bash
npm config get registry
# Should output: https://registry.npmjs.org/
3Check and fix your .npmrc file

Locate your .npmrc files at ~/.npmrc (global) or in your project root.

Ensure it contains a valid registry line:

bash
registry=https://registry.npmjs.org/

On Windows, verify the file encoding is UTF-8, not UCS-2 LE BOM.

4Clear npm cache and reinstall dependencies

Clear any corrupted cache files:

bash
npm cache clean --force
rm -rf node_modules package-lock.json
npm install
5Verify network connectivity

Ensure you can reach the registry server:

bash
curl https://registry.npmjs.org/

If behind a proxy, configure npm to use it:

bash
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

Advanced 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