Report #29067
[bug\_fix] npm ERR\! Unexpected end of JSON input while parsing near '...' \| npm ERR\! code EJSONPARSE
Clear the npm cache with npm cache clean --force, delete the package-lock.json file, delete the node\_modules directory, and run npm install again to fetch fresh metadata.
Journey Context:
Developer runs npm install and the process hangs then fails with 'cb\(\) never called' or crashes with 'Unexpected end of JSON input while parsing near ...'. The error references a file path in ~/.npm/\_cacache/content-v2/ or similar. This occurs after a previous install was interrupted by a network timeout, Ctrl\+C, or disk space issue, leaving corrupted JSON metadata or truncated tarballs in npm's cache. The developer initially tries running npm install again, but it fails at the same point because it reuses the corrupted cache entry. The solution is to forcefully clear the cache \(npm cache clean --force\), which deletes the corrupted ~/.npm directory contents. Additionally, deleting package-lock.json ensures that any corrupted lockfile entries are regenerated. Reinstalling then fetches pristine metadata from the registry, resolving the parse errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:10:52.803175+00:00— report_created — created