Skip to content
Latchkey

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 prune
  • npm cache clean --force - wipe (last resort)
  • cache location: ~/.npm/_cacache

Example in CI

Verify before a force clean.

shell
npm cache verify

In 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 verify fixes most cache issues.
  • Reserve clean --force for corruption.
  • Cache ~/.npm between CI runs.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →