How to fix npm ERR! cb() never called! npm ERR! This is an error with npm itself in npm

npmINTERMEDIATEMEDIUMUpdated Dec 5, 2025· 106 views

The 'cb() never called' error indicates npm's internal callback function failed to execute during installation. The fix typically involves clearing the npm cache, checking network connectivity, or updating npm/Node.js versions.

Quick fix

Fixes npm ERR! cb() never called! npm ERR! This is an error with npm itself

# Test connectivity to npmjs.org
ping registry.npmjs.org

# Or verify HTTPS access with curl
curl -I https://registry.npmjs.org/
  1. Check network connectivity
  2. Verify and clear npm cache
  3. Clean install (delete node_modules and lock file)
  4. Update Node.js and npm
npm — error
# Test connectivity to npmjs.org
ping registry.npmjs.org
# Or verify HTTPS access with curl
curl -I https://registry.npmjs.org/
npm ERR! cb() never called!
npm ERR! This is an error with npm itself

What this error means

The "npm ERR! cb() never called!" error indicates that npm's internal callback function failed to execute during the installation process, leaving the package installation incomplete. The "cb()" function is a vanilla callback used by npm to mark when an install completes, and when it never gets called, npm has no way to know the installation finished. This error typically points to infrastructure issues (corrupted cache, network problems, or version incompatibilities) rather than problems with your code or dependencies themselves. Something interrupted the process before completion. The error is often related to network connectivity timeouts, corrupted npm cache, or incompatibilities between Node.js and npm versions.

Typical symptoms

  • npm install command hangs and then terminates with the 'cb() never called!' error message
  • Installation freezes partway through downloading packages with no progress output
  • Error appears inconsistently on the same machine or project
  • Works fine when using an alternative package manager like Yarn
  • Error persists even after multiple retry attempts

Common causes

  1. Corrupted or overloaded npm cache—downloaded packages or metadata may have been corrupted due to interrupted downloads
  2. Network connectivity timeouts or registry issues—connection timeouts when reaching npmjs.org prevent npm from completing
  3. Outdated Node.js or npm versions—running incompatible versions can trigger internal bugs where callbacks aren't invoked
  4. Proxy or firewall restrictions—corporate proxies or firewalls can block or delay npm's connection to the registry
  5. Package-lock.json conflicts—a corrupted or stale lock file can cause npm's dependency resolution to fail
  6. Cross-device link issues—in some environments (NFS mounts, Docker volumes), npm cache may be on different filesystems

How to fix "npm ERR! cb() never called! npm ERR! This is an error with npm itself"

1Check network connectivity

Before making any changes, ensure you can reach the npm registry:

bash
# Test connectivity to npmjs.org
ping registry.npmjs.org

# Or verify HTTPS access with curl
curl -I https://registry.npmjs.org/

If you cannot reach the registry, check your internet connection and any firewall/proxy settings. If you're behind a proxy, configure npm:

bash
npm config set proxy http://proxy.example.com:8080
npm config set https-proxy http://proxy.example.com:8080
2Verify and clear npm cache

This is the first troubleshooting step recommended by npm maintainers:

bash
# Verify cache integrity and report issues
npm cache verify

# If verify shows corruption, force a clean
npm cache clean --force

# Verify again after cleaning
npm cache verify

The npm cache verify command checks for corrupted data and fixes minor issues automatically. After cleaning, try your install again:

bash
npm install
3Clean install (delete node_modules and lock file)

If cache cleaning doesn't work, perform a complete clean install:

bash
# Remove node_modules directory
rm -rf node_modules

# Remove the lock file
rm package-lock.json

# Verify cache again
npm cache verify

# Fresh install
npm install

This forces npm to re-download everything and rebuild the dependency tree from scratch.

For CI/CD environments, you can add the --no-package-lock flag to skip lock file generation:

bash
npm install --no-package-lock
4Update Node.js and npm

Outdated Node.js or npm versions can have bugs that trigger the "cb() never called" error. Update to the latest stable versions:

bash
# Update npm globally to latest version
npm install -g npm@latest

# Check versions
node --version
npm --version

If you're using an older Node.js version (pre-8.0), upgrade to a modern LTS release:

bash
# Install nvm and switch to Node 18
nvm install 18
nvm use 18
npm install  # Now try install with newer versions

Multiple users report the issue disappearing after upgrading to Node 18 with npm 8/9.

5Check for dependency conflicts

The error can occur if two packages require incompatible versions of the same dependency:

bash
# Show outdated packages
npm outdated

# List dependency conflicts
npm ls

# Try updating all packages to compatible versions
npm update

Review your package.json file and ensure versions are compatible. If conflicts exist, you may need to:
1. Update packages to newer versions that share compatible dependencies
2. Use npm ci (clean install) instead of npm install
3. Manually adjust version constraints in package.json

6Alternative: Switch to Yarn (if all else fails)

If the error persists after all the above steps, some users report that switching to Yarn resolves the issue:

bash
# Install Yarn globally
npm install -g yarn

# Use Yarn to install dependencies instead
yarn install

# Or for CI/CD environments
yarn install --frozen-lockfile

Yarn uses the same package.json and node_modules folder as npm but has different dependency resolution and caching logic. If npm consistently fails while Yarn succeeds, it indicates a specific incompatibility with your npm version.

Advanced notes

Environment-Specific Issues:
- NFS Mounts & Docker: If $HOME and npm's $PREFIX are on different filesystems, npm can encounter cross-device link errors. Configure npm's cache to the same filesystem using npm config set cache /path/on/same/device.
- CI/CD Pipelines: In GitHub Actions, GitLab CI, or Heroku, use npm ci (clean install) instead of npm install to use the exact versions from package-lock.json.
- Corporate Proxies with SSL Inspection: If your organization intercepts SSL traffic, npm may fail SSL validation. As a last resort, disable strict SSL checking: npm config set strict-ssl false (not recommended for security-sensitive projects).
- Memory Constraints: On systems with limited RAM (containers, embedded systems), npm's cache operations can fail. Reduce cache pressure with npm config set cache-min 0.

Reporting: This is documented as a known npm issue. If none of these steps resolve your problem, report it to the npm feedback repository with your Node/npm versions and detailed error logs (npm install --verbose).

Frequently asked questions

What does "npm ERR! cb() never called! npm ERR! This is an error with npm itself" mean?
The "npm ERR! " error indicates that npm's internal callback function failed to execute during the installation process, leaving the package installation incomplete. The "cb()" function is a vanilla callback used by npm to mark when an install completes, and when it never gets called, npm has no way to know the installation finished.
How do I fix "npm ERR! cb() never called! npm ERR! This is an error with npm itself"?
The 'cb() never called' error indicates npm's internal callback function failed to execute during installation. The fix typically involves clearing the npm cache, checking network connectivity, or updating npm/Node.js versions.
What causes "npm ERR! cb() never called! npm ERR! This is an error with npm itself"?
Corrupted or overloaded npm cache—downloaded packages or metadata may have been corrupted due to interrupted downloads Network connectivity timeouts or registry issues—connection timeouts when reaching npmjs.org prevent npm from completing Outdated Node.js or npm versions—running incompatible versions can trigger internal bugs where callbacks aren't invoked
Is the "npm ERR! cb() never called! npm ERR! This is an error with npm itself" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading