The npm cache is huge: is it safe to clear?
Short answer: yes. npm's cache (%LocalAppData%\npm-cache) only holds copies of packages it downloaded. Clear it and npm downloads what it needs again on the next install. It costs only time and bandwidth.
By hand
- Check it:
npm cache verify(this also tidies it). - Clear it:
npm cache clean --force - pnpm and Yarn keep their own:
pnpm store prune,yarn cache clean. - Often bigger are the
node_modulesfolders in old projects. Those belong to each project, so delete them only in projects you no longer work on.
With Sparewise
- Finds npm, pnpm, Yarn, pip, uv, NuGet, Gradle, Maven, Cargo and Go caches in one scan.
- Says whether each rebuilds by itself, and why.
- Moves what you choose to the Recycle Bin, so you can put it back.