How to fix npm ERR! cb() never called! npm ERR! This is an error with npm's caching system in npm

npmINTERMEDIATEHIGHUpdated Dec 3, 2025ยท 183 views

The 'cb() never called' error occurs when npm's installation process is interrupted or the callback function fails to complete, usually due to cache corruption, network issues, or insufficient system resources. This error indicates that npm crashed internally and left the installation unfinished.

Quick fix

Fixes npm ERR! cb() never called! npm ERR! This is an error with npm's caching system

npm cache clean --force
npm cache verify
  1. Clear and verify the npm cache
  2. Delete package-lock.json and node_modules
  3. Update npm and Node.js to latest versions
  4. Check available disk space
npm โ€” error
npm cache clean --force
npm cache verify
npm ERR! cb() never called!
npm ERR! This is an error with npm's caching system

What this error means

The cb() function is a vanilla callback used by npm install to signal when the installation is complete. When this error appears, it means the callback was never invoked, indicating that the npm installation process crashed or was interrupted. This is typically caused by corrupted npm cache data, network connectivity problems, insufficient disk space, or outdated npm/Node.js versions.

Typical symptoms

  • npm install or npm ci command hangs and then fails with 'cb() never called' message
  • Installation process appears to stall mid-way without visible progress
  • Error occurs inconsistently, sometimes on retry it works
  • CI/CD pipelines fail during the npm install step
  • The error appears when installing large projects with many dependencies

Common causes

  1. Corrupted npm cache containing invalid or incomplete package data
  2. Insufficient disk space preventing node_modules folder creation
  3. Network connectivity issues or timeouts reaching npm registry
  4. Outdated npm or Node.js version with known cache bugs
  5. Package-lock.json version mismatch with current npm version
  6. File descriptor limit too low on Unix-based systems

How to fix "npm ERR! cb() never called! npm ERR! This is an error with npm's caching system"

1Clear and verify the npm cache

Start by clearing your npm cache completely, then verify its integrity:

bash
npm cache clean --force
npm cache verify

The --force flag bypasses safety checks and completely removes cached data.

2Delete package-lock.json and node_modules

Remove your lock file and node_modules folder to force a fresh install:

bash
rm -rf node_modules package-lock.json
npm cache verify
npm install
3Update npm and Node.js to latest versions

Ensure you're running current versions, as older versions contain known bugs:

bash
npm install -g npm@latest
node --version

Consider using nvm to manage Node.js versions:

bash
nvm install node
nvm use node
4Check available disk space

Verify you have at least 2-3 GB of free disk space:

bash
df -h  # macOS/Linux

If space is limited, delete temporary files before retrying installation.

5Increase file descriptor limit (Linux/macOS)

On Unix-based systems, npm may hit the file descriptor limit:

bash
ulimit -n 20000

To make permanent, add to your shell profile (~/.bashrc or ~/.zshrc).

Advanced notes

The 'cb() never called' error is fundamentally an npm internal failure. In npm v5+, the cache system is designed to self-heal from corruption using npm cache verify. However, if corruption is severe, complete clearing with npm cache clean --force is needed. This error is increasingly rare on npm v7+ due to improved caching algorithms, so upgrading Node.js is often the quickest fix.

Frequently asked questions

What does "npm ERR! cb() never called! npm ERR! This is an error with npm's cachi" mean?
The cb() function is a vanilla callback used by npm install to signal when the installation is complete. When this error appears, it means the callback was never invoked, indicating that the npm installation process crashed or was interrupted. js versions.
How do I fix "npm ERR! cb() never called! npm ERR! This is an error with npm's cachi"?
The 'cb() never called' error occurs when npm's installation process is interrupted or the callback function fails to complete, usually due to cache corruption, network issues, or insufficient system resources. This error indicates that npm crashed internally and left the installation unfinished.
What causes "npm ERR! cb() never called! npm ERR! This is an error with npm's cachi"?
Corrupted npm cache containing invalid or incomplete package data Insufficient disk space preventing node_modules folder creation Network connectivity issues or timeouts reaching npm registry
Is the "npm ERR! cb() never called! npm ERR! This is an error with npm's cachi" 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