Why your node_modules is so big — and how to reclaim the space
A single Node project's node_modules can be hundreds of MB. Have twenty old projects sitting around and that's easily 20–40 GB of your SSD gone — for dependencies you can regenerate in seconds with npm install.
Why does node_modules get this large?
npm installs a full dependency tree, not just the package you asked for. One small library can pull in dozens of transitive dependencies, each with its own files, source maps, prebuilt binaries, and TypeScript types. Frameworks make it worse — a fresh Next.js, Vite, or React Native app starts at 300–600 MB before you write a line of code. Multiply that across every project, branch, and experiment you've ever cloned, and it adds up fast.
The key insight: node_modules is disposable. It's a build artifact derived from package.json and your lockfile. Delete it and one command rebuilds it exactly. Nothing you wrote lives there.
SweepDisk scans your whole drive and groups build caches — node_modules, __pycache__, .next, target — so you can see the total and clear it in one click.
How to find every node_modules folder on Windows
Option 1 — the manual way (PowerShell)
List every node_modules folder under your projects directory with its size:
Get-ChildItem -Path C:\dev -Recurse -Directory -Filter node_modules -ErrorAction SilentlyContinue |
ForEach-Object {
$s = (Get-ChildItem $_.FullName -Recurse -File -EA SilentlyContinue | Measure-Object Length -Sum).Sum
[pscustomobject]@{ Path = $_.FullName; GB = [math]::Round($s/1GB,2) }
} | Sort-Object GB -Descending
It's slow (it walks every file twice) and only covers the path you point it at, but it works with nothing installed.
Option 2 — npkill
The popular npkill tool lists node_modules interactively so you can delete them one by one:
npx npkill
Great for a single projects folder — though it only looks below your current directory and needs you to pick through them by hand.
Option 3 — SweepDisk (whole drive, one click)
SweepDisk scans every drive, buckets node_modules together with your other regenerable dev caches (__pycache__, .next, .gradle, target, dist), shows one reclaimable total, and moves them to the Recycle Bin on a single click — so nothing is gone for good.
How to delete node_modules safely
Deleting node_modules is safe as long as you keep package.json and the lockfile (which live in the project root, not inside node_modules). To rebuild, just run your package manager's install again:
# in the project folder
npm install # or: pnpm install / yarn
The one thing to watch: don't delete node_modules for a project you're actively running — you'll just reinstall it moments later. Clear the ones from finished or dormant projects.
Prevent the buildup
- Use pnpm. It stores one global content-addressed store and hard-links packages into each project, so shared dependencies aren't duplicated on disk.
- Archive old projects without their node_modules — the manifest is enough to restore them.
- Scan periodically. Caches regrow. A quick monthly sweep keeps 20–40 GB from silently accumulating.
Free categorized scan. Windows 10 & 11. Nothing is uploaded and nothing is deleted without your click.