npm cache clean and verify
The npm cache speeds installs by storing downloaded tarballs.
A corrupt cache can cause EINTEGRITY errors. npm cache verify usually fixes it without a destructive clean.
Common usage
npm cache verify- check and prunenpm cache clean --force- wipe (last resort)- cache location:
~/.npm/_cacache
Example in CI
Verify before a force clean.
shell
npm cache verifyIn CI
Cache ~/.npm across runs. If you hit EINTEGRITY, try npm cache verify first; a forced clean only helps if the cache is genuinely corrupt.
Key takeaways
npm cache verifyfixes most cache issues.- Reserve
clean --forcefor corruption. - Cache
~/.npmbetween CI runs.