misonoteApp Center

npm cache (~/.npm/_cacache) on Mac: safe to delete?

Safe to deleteRegenerated automatically; Thermo deletes it outright.

Quit first: npm

Where it is

  • ~/.npm/_cacache
  • ~/.npm/_logs

What it is

_cacache is npm's content-addressable cache: every package tarball and registry metadata response npm downloads is stored there, keyed by its integrity hash, so later installs can skip the network. The _logs folder holds debug logs that npm writes when commands run or fail.

Why it gets so big

npm doesn't evict old entries on its own, so every version of every package you've installed stays in the cache. Across many projects and years of upgrades, it routinely reaches several GB.

Is it safe to delete?

Yes. Your projects' node_modules folders are separate copies and keep working; the only cost is that the next install of an uncached package downloads it again. Quit any running npm command first, then use npm's own clean command or remove the folders.

Tip

If you'd rather trim than wipe, npm's cache verify subcommand garbage-collects data that's no longer needed and checks the rest for integrity.

See how much space it uses

du -sh "$HOME/.npm/_cacache" "$HOME/.npm/_logs" 2>/dev/null

Clean it with the tool’s own command

npm cache clean --force

Delete it by hand

Run in Terminal. Deleting cannot be undone, so check the paths first.

rm -rf "$HOME/.npm/_cacache"
rm -rf "$HOME/.npm/_logs"