Report #69729
[bug\_fix] npm ERR\! code EINTEGRITY sha512-... integrity checksum failed when fetching ...
Run \`npm cache clean --force\` to purge corrupted tarballs, then delete \`node\_modules\` and \`package-lock.json\`, and reinstall with \`npm install\`.
Journey Context:
Developer runs \`npm install\` and the process halts with \`EINTEGRITY\` and a SHA512 checksum mismatch for a package like \`lodash\` or a private registry package. The error suggests the tarball is corrupted or tampered with. Developer retries \`npm install\` and gets the same error, ruling out a transient network blip. They check the registry via browser and the package seems fine. They suspect a proxy or corporate firewall is modifying responses. However, the real issue is usually in npm's content-addressable cache \(\`~/.npm/\_cacache\`\). A previous interrupted download or a disk error stored a corrupted tarball indexed by the expected integrity hash. When npm tries to reinstall, it reuses the corrupted cache file, causing the checksum failure. The debugging involves running \`npm cache verify\` which may not catch the specific corruption, or checking the cache content manually. The fix works because \`npm cache clean --force\` deletes all cached metadata and tarballs, forcing npm to re-fetch fresh, uncorrupted copies from the registry. Deleting the local \`node\_modules\` and \`package-lock.json\` ensures no stale references remain.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:31:40.840604+00:00— report_created — created