npm "cb() never called!" - Diagnose the Legacy npm Internal Error
By Kaveh Alemi·Latchkey
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 output
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.
Move to a current npm where the known callback bugs are fixed.
Terminal
npm install -g npm@latest
npm --version
How to prevent it
Keep npm reasonably current in CI runner images.
Cache ~/.npm but verify it; evict on corruption rather than reusing blindly.
Pin a packageManager version so npm does not silently drift.
Frequently asked questions
What causes ""cb() never called!""?
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.
How do I fix "cb() never called!"?
Verify and, if needed, force-clean the npm cache, then reinstall.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.