How to fix npm ERR! cb() never called! npm ERR! This is an error with npm's caching system in npm
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- Clear and verify the npm cache
- Delete package-lock.json and node_modules
- Update npm and Node.js to latest versions
- Check available disk space
npm cache clean --forcenpm cache verifynpm 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
- 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
- Outdated npm or Node.js version with known cache bugs
- Package-lock.json version mismatch with current npm version
- 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"
Start by clearing your npm cache completely, then verify its integrity:
npm cache clean --force
npm cache verifyThe --force flag bypasses safety checks and completely removes cached data.
Remove your lock file and node_modules folder to force a fresh install:
rm -rf node_modules package-lock.json
npm cache verify
npm installEnsure you're running current versions, as older versions contain known bugs:
npm install -g npm@latest
node --versionConsider using nvm to manage Node.js versions:
nvm install node
nvm use nodeVerify you have at least 2-3 GB of free disk space:
df -h # macOS/LinuxIf space is limited, delete temporary files before retrying installation.
On Unix-based systems, npm may hit the file descriptor limit:
ulimit -n 20000To 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
- ๐npm Official Documentation
- ๐npm Docs: npm cache(Official Docs)
- ๐ฌStack Overflow: npm Cache Errors(Stack Overflow)
- ๐npm GitHub Issues(GitHub)