SpaceSentinel

npm Cache Over 10GB? How to Clean It and Move It for Good (for Developers)

Real case: a dev machine's npm-cache had grown to 11.4GB. Cleaning gives temporary relief (it grows back) — permanently relocating the cache path is the actual fix.

  1. See how big it is: du -sh $(npm config get cache) (or check %AppData%\npm-cache and %LocalAppData%\npm-cache sizes)
  2. One-time wipe: npm cache clean --force (the cache only affects install speed — deleting it is completely safe)
  3. Permanent fix (recommended): npm config set cache D:\npm-cache — all future cache writes go to D:, your system drive is immune from now on
  4. Handle sibling caches too: pip cache purge (Python), yarn cache clean, pnpm store prune
  5. Bonus: check npm config get prefix — if your global packages also live under the C: user profile, consider relocating them as well (remember to update PATH afterwards)
Download the free open-source Windows cleaner

FAQ

Is deleting the npm cache risky?

No. The cache is just copies of downloaded packages — after deletion the next npm install re-downloads what it needs, slightly slower once.

Why do I have two npm cache folders?

Older npm used %AppData%\npm-cache (Roaming); newer versions use %LocalAppData%\npm-cache. Machines that upgraded Node often have leftovers in both — both are safe to clean.