JavaScript projects duplicate dependencies per folder. A few forgotten repos can outgrow your Photos library.
Finding them is the hard part; deleting a node_modules folder is safe if you still have package.json / lockfiles to reinstall.
Find node_modules
find ~ -type d -name node_modules -prune 2>/dev/nullOr use DoomDisk Space Map / junk scanning to spot heavy project trees visually without memorizing paths.
Delete safely
- Confirm the project still has package.json (and ideally a lockfile).
- Quit any dev server using that tree.
- Move node_modules to Trash (or rm -rf inside that project only).
- Empty Trash when sure.
Keep future projects lean
- Delete node_modules when archiving a repo.
- Prefer pnpm/Yarn where disk sharing helps on large monorepos.
- Clear global npm/Yarn caches occasionally if they balloon.
FAQ
Will deleting node_modules break git?
No. Dependencies are reinstalled from the lockfile / package.json.
What about .next or dist folders?
Also safe to delete for most apps — rebuild with your usual command.
Can DoomDisk find these?
Yes — Space Map and junk views surface large dependency trees by size.