Report #66249
[bug\_fix] npm ERR\! cb\(\) never called / EACCES: permission denied, scandir '/root/.npm/\_cacache'
The npm cache directory \(~/.npm\) has corrupted metadata or incorrect ownership/permissions, often caused by interrupted installs or running npm with sudo. Run npm cache clean --force to wipe the corrupted cache index, then remove node\_modules and package-lock.json. If permission denied, fix ownership with sudo chown -R $\(whoami\) ~/.npm \(never run npm install with sudo\) or change the cache directory via npm config set cache /tmp/npm-cache.
Journey Context:
Running npm install suddenly crashes with 'cb\(\) never called' or 'EACCES permission denied' pointing to ~/.npm/\_cacache. The error persists across different projects. Checking the npm debug log reveals integrity checksum failures or 'invalid json' errors reading cache files. This indicates the cacache content-addressable store has corrupted index entries from a previous interrupted write or disk issue. The fix is force-cleaning the cache with npm cache clean --force, which deletes the \_cacache directory entirely. Following this, removing node\_modules ensures no stale symlinks reference corrupted cache entries. Re-running install rebuilds the cache cleanly, resolving the callback error that occurs when npm's cacache library cannot invoke the callback due to corrupted stream pipelines.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:40:37.857403+00:00— report_created — created