Reference / Fix an error
npm ENOSPC / "no space left on device" during install
Reclaim 20+ GB safely ยท reversible
An npm install died on disk space. The npm cache and stray node_modules are usually the fastest, safest things to clear โ they all re-download.
30-second triage
See how full you are and what's safe to clear:
$ df -h / # confirm it's disk, not inodes
$ diskspace detect # rank node/npm bloat
$ npm cache verify # npm's own checkWhat's usually eating it
Each links to a plain verdict โ does it come back if you delete it?
Is it safe to delete ~/.npm/_cacache on a Mac?~/.npm/_cacacheSafe to deleteIs it safe to delete ~/.npm/_npx on a Mac?~/.npm/_npxSafe to deleteIs it safe to delete node_modules folders on a Mac?**/node_modulesSafe to deleteIs it safe to delete ~/.pnpm-store on a Mac?~/.pnpm-storeSafe to delete
The one-command fix
diskspace frees exactly what you need, pressure-tests every candidate against live disk state, and stages it reversibly โ so an agent or a human can run it without fear.
$ brew install tymrtn/diskspace/diskspace
$ diskspace doctor --need 20G --yes # scan โ pressure-test โ free