npm "cb() never called!" - Diagnose the Legacy npm Internal Error
npm aborted with its own internal "cb() never called!" error - an async callback that npm expected to fire never did. It is most often a corrupted npm cache or a known bug in an older npm, not a problem in your dependencies.
What this error means
An install or publish dies with npm ERR! cb() never called! and a note that this is an error with npm itself. It can be intermittent (a half-written cache entry) and frequently clears after wiping the cache or upgrading npm.
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/cli/issues>
npm ERR! at cb (/usr/lib/node_modules/npm/.../index.js:...)Common causes
Corrupted npm cache
A partially-written or damaged entry in ~/.npm/_cacache can leave npm waiting on a callback that never resolves. Clearing the cache removes the bad entry.
An old npm with a known bug
Several cb() never called reports trace to bugs fixed in later npm releases. An outdated npm bundled with an old Node hits them.
How to fix it
Clear the cache and reinstall
Verify and, if needed, force-clean the npm cache, then reinstall.
npm cache verify
npm cache clean --force
rm -rf node_modules
npm ciUpgrade npm (and Node)
Move to a current npm where the known callback bugs are fixed.
npm install -g npm@latest
npm --versionHow to prevent it
- Keep npm reasonably current in CI runner images.
- Cache
~/.npmbut verify it; evict on corruption rather than reusing blindly. - Pin a
packageManagerversion so npm does not silently drift.