node_modules is eating your disk
A single modern JS project carries 200-800 MB of node_modules. Twenty experiments from the last two years - and that is 10-15 GB of dependencies no one will ever run again. Rust and Python do the same with target and .venv; on a dev machine build artifacts routinely out-eat photos and video.
What regenerates for free
| Folder | Ecosystem | Comes back with |
|---|---|---|
| node_modules | JS/TS | npm install / pnpm install |
| target | Rust | cargo build |
| .venv, __pycache__ | Python | pip install -r requirements.txt |
| bin, obj | .NET | dotnet build |
| build, dist, .next, .turbo | bundlers | next build etc. |
| ~/.npm, ~/.cargo/registry, pip cache | package caches | re-downloaded on demand |
Everything in the table is a cache in the broad sense: deleting it loses nothing but the time of the next build of that specific project.
Finding every copy
The problem is not one folder, it is thirty scattered across old projects. On a disk map they stand out immediately: uniform mid-size sectors under each project folder. Open your projects directory in CleanMyWin - each node_modules is a click away from the Recycle Bin, including paths deeper than 260 characters, on which Explorer's own delete gives up.
Package caches are cleaned by their own tools: npm cache clean --force, pnpm store prune, cargo cache -a (needs cargo-cache), pip cache purge, docker system prune.
Keeping it from growing back
- pnpm instead of npm: one shared store instead of a copy per project.
- A quarterly sweep of the projects folder beats any daily hygiene.
- Docker: docker system prune -a periodically - images grow silently into tens of gigabytes.
Frequently asked
Is it safe to delete node_modules?
Yes. It is fully regenerated by npm install from package.json and the lockfile. You lose only the reinstall time of that project.
How do I find all node_modules on the drive?
Scan the drive with a space analyzer and look for repeating mid-size sectors under project folders - or search the map for the heaviest directories.
Sources and official documentation: Microsoft: Free up drive space in Windows, Microsoft: Storage Sense, Microsoft: WSL disk space, DaisyDisk, WizTree, WinDirStat, TreeSize
See where your terabytes went
One scan takes a minute. The first 24 hours are free.
Download for Windows