Developer storage guide
How to remove old node_modules without losing project work
A node_modules directory is normally reproducible from a trustworthy manifest and lockfile, but local patches, unpublished packages, or an unavailable registry can make removal costly. Find candidates by size and project age, verify reproducibility, and remove one project at a time.
What macOS can do on its own
Terminal can locate dependency trees, but broad find-and-delete commands are dangerous. Separate discovery from removal.
- Search likely project roots for node_modules directories and report their sizes without deleting anything.
- Open each parent project and confirm its package manifest, lockfile, remote repository, and current working-tree status.
- Preserve local patches, linked packages, generated assets, and unpublished dependencies before removal.
- Move one confirmed directory to Trash, reinstall with the project’s documented package manager, and run its verification commands.
When Mint helps
Mint is useful when dependency trees are scattered across old projects and need a reviewable inventory.
- Scan supported project locations for stale node_modules and other package-manager artifacts.
- Compare path, size, and recency before deciding whether a project is actually inactive.
- Dry-run a stale-dependency cleanup rule and inspect every candidate before execution.
- Move approved directories to Trash and retain a journal receipt instead of issuing an unscoped recursive delete.
Boundaries and safety checks
Reinstallable is not the same as backed up.
- Confirm the exact package manager and lockfile; mixing npm, pnpm, Yarn, or Bun can change the resolved tree.
- Offline or retired registries can make an old dependency impossible to fetch later.
- Never target a broad home or workspace root with an unresolved glob or recursive deletion command.
Frequently asked questions
Can I delete every node_modules folder?
No. Active projects need their dependencies, and some trees contain local changes or packages that may no longer be downloadable. Verify one project at a time.
Will deleting node_modules delete my source code?
It should not when the exact node_modules path is selected, but a mistaken recursive command can. Inspect resolved paths and prefer a recoverable move to Trash.
What should I verify before removal?
Check the manifest, lockfile, package-manager version, repository status, local patches, registry availability, and the project’s install and test commands.
Inventory stale dependency trees first
Scan for node_modules, verify the parent project and lockfile, then move one approved tree to Trash.