From the studio
Deleting node_modules without regretting it
A JavaScript project keeps its installed packages in node_modules. The folder is often the largest thing in the project, it can be recreated with the package manager, and a machine that has checked out ten apps can hold ten copies. That is why “delete node_modules” shows up in every list of ways to free up space on a MacBook. It is also why the advice is incomplete.
The folder is not the cache
node_modules belongs to one project. The npm cache is the store of package tarballs npm keeps so the next install does not download everything again. Gradle and Cargo have their own caches. Xcode has DerivedData. Disk Housekeeper Smart Clean knows that set: developer caches such as npm, Gradle, Cargo, and Xcode DerivedData, plus node_modules.
If you only delete node_modules, the npm cache is still there. If you only clear the npm cache, every project’s node_modules is still there. The guide to cleaning developer files walks through both, because they fail in different ways.
Clearing a cache means the next resolve may need a network. Deleting node_modules means the next time you work in that project you run the install command your lockfile expects. Neither one is mysterious. Both are annoying if you do them to a project you meant to open on a plane.
Preview is the whole point
Smart Clean can find these folders. Finding them is not the same as removing them. Disk Housekeeper always shows a preview before cleaning. Read the list. A monorepo can contain more than one node_modules. A sample app inside a dependency can contain another. The preview is where you notice that the path is a project you are about to demo, not a project you abandoned.
Removals go to the Trash by default. That is the recovery path. Space comes back when you empty the Trash, not when the file merely leaves the project folder. If the menu bar readout barely moves, check the Trash before you assume the clean failed. Purgeable space can also make the Storage window and the free-space readout tell different stories. The glossary entry is the short version. The savings history is the record of what the app itself moved.
A sequence that does not invent courage
- Look at the free-space readout so you know the starting point.
- Run Smart Clean and read the preview. Keep the projects you are using this week.
- Let the removal go to the Trash.
- Open one of the projects you cleaned and install from the lockfile before you empty the Trash.
- If the install works, empty the Trash when you want the space.
That sequence is the use case Delete node_modules safely. Autopilot can watch a folder later, but it does not skip the preview. A watched folder is not a reason to stop looking.
We do not publish a typical gigabyte figure for this. Your projects are not our projects. The history in the app is the number that belongs to your Mac.