Yes, for projects you aren't working on. node_modules only holds packages installed from the project's package.json and lockfile; npm install, yarn or pnpm install puts them back exactly.
How big it gets
On the Mac we measured, a working developer's Mac on macOS 27: 0.3 GB in 2 projects here; on Macs with many old web projects, they easily add up to tens of gigabytes.
What it is
npm install, yarn, pnpm install or bun install, inside each project folder.How to clear it
- List them with sizes, from a folder holding your projects:
find . -name node_modules -type d -prune -exec du -sh {} + - Delete the ones in projects you haven't touched for a while.
- Package caches are separate:
npm cache clean --force,yarn cache clean,pnpm store prune.
What you lose: Nothing, as long as the lockfile stays. Reinstalling needs the network.
With Scrubs: Scrubs's Quick Wins finds node_modules in projects with nothing changed for 30 days and moves the ones you pick to the Trash. Download Scrubs; scanning is free.
Related folders
Sizes measured with du on 1 November 2026. Paths and commands apply to macOS 15 and later. See also how to free up disk space on a Mac.
About the author: Parsa Nasirimehr is a mobile app developer who builds Scrubs, a disk map for the Mac. Spotted something wrong? Write to support@getscrubs.app.