Back to All Guides
Cross-Platform Cross-PlatformDeveloperDeep Cleanup

node_modules Isn't Just a Mac Problem

You built a side project six months ago, forgot about it, and its 1.2GB node_modules folder has been quietly camping out on your drive ever since. JavaScript tooling is notorious for deep dependency trees. A simple web app with React, Next.js, or Vite can easily pull in 45,000 files spread across 800MB. Multiply that by thirty tutorial repositories and stale Git clones, and you have over 50GB of dead dependencies that serve zero purpose.

What's Actually Going On

node_modules folders are completely disposable because package.json and your lockfile guarantee you can recreate them anytime with npm install.

On Windows, deleting node_modules via File Explorer can take up to 20 minutes because the NTFS filesystem must individually unlink tens of thousands of tiny text files.

Traditional cleaner apps treat node_modules as regular user data and ignore them completely, leaving developers with zero automated visibility.

Commands to Find and Purge Stale node_modules

1. Find Stale Folders on Windows (PowerShell)

Run a PowerShell command scoped to your development directory to list every node_modules folder and its file size.

powershell
Get-ChildItem -Path "$HOME\Projects" -Recurse -Directory -Filter "node_modules" -ErrorAction SilentlyContinue | Select-Object FullName

2. Fast Parallel Deletion on Windows

Do not use File Explorer right-click delete. Use rimraf or PowerShell batch piping to deallocate the file tree asynchronously.

powershell
Get-ChildItem -Path "$HOME\Projects" -Recurse -Directory -Filter "node_modules" | Remove-Item -Recurse -Force

3. Find Stale Folders on macOS / Linux

On macOS, use the native Unix find command to isolate and delete node_modules directories older than 60 days.

bash
find ~/Projects -name "node_modules" -type d -prune -mtime +60 -exec rm -rf {} +

We got tired of doing this manually — that's exactly why we built Orbit.

Orbit Interface Orbit Dev Junk Scanner aggregates all node_modules across your disks with one-click cleanup.

One More Thing

Consider switching to modern package managers like pnpm. Instead of copying duplicate dependencies into every project, pnpm stores all packages in a single global content-addressable store.

Using hard links across projects can save you 40GB to 80GB of disk space right out of the gate.

The Verdict

Use Manual Method if: Use terminal find or Get-ChildItem scripts if all your code lives neatly in a single ~/Projects folder.

Use Orbit if: Use Orbit if your projects are scattered across multiple drives and you want to clean them with a single click.

Finding these files too slow?

Orbit visualizes your entire drive — Mac and Windows both — so you see exactly where space is going before you delete anything.

Orbit Interface

Continue Reading