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.
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.
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).
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.
npm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
npm ERR! code EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code EMPTYPACKAGE npm ERR! Package contains no files
How to fix 'npm ERR! code EMPTYPACKAGE' - Package contains no files
npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: packages/missing
How to fix "npm ERR! code EWORKSPACEMISSING - Workspace does not exist" error
npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Address not available
How to fix "npm ERR! code EADDRNOTAVAIL - Address not available" error