Join the waitlistJoin
← All cleanup guides
Node.js

node_modules in old projects: is it safe to delete?

Packages that npm, Yarn or pnpm installed for one project, in the node_modules folder next to the project's package.json.

Where it lives
  • ~/Developer/**/node_modules
  • ~/source/**/node_modules
  • ~/Projects/**/node_modules
  • ~/Code/**/node_modules
  • ~/src/**/node_modules
  • ~/repos/**/node_modules
  • ~/workspace/**/node_modules
  • ~/dev/**/node_modules
Risk
Review. Safe in many cases, but only you know if you still need it. Never preselected.
Comes back on its own
Yes
If you delete it
The project needs a full install again (npm install, yarn or pnpm install) before it builds or runs, which downloads every package and can take minutes; a package version that is no longer published cannot be installed again.
What SPACE256 does
Moves it to the Trash after you confirm in Review, so you can put it back.

What it is

A node_modules folder holds the packages that npm, Yarn or pnpm installed for one project, next to that project’s package.json. It is needed to build and run the project, and it can be recreated by installing again.

Why it grows

Every project has its own copy of its dependencies, often hundreds of megabytes each. Old experiments, cloned repositories and finished client work keep theirs long after you last ran them.

When to clear it

For projects you haven’t touched in months. SPACE256 looks only at projects that have been inactive for the period you set, in the usual code folders (Developer, source, Projects, Code, src, repos, workspace, dev).

When to keep it

Keep it for projects you work on, and for old projects that depend on package versions that may no longer be published.

How SPACE256 clears it

You review each folder, and the ones you choose move to the Trash, so you can put them back.

Questions

Which projects does SPACE256 consider inactive?

Projects where nothing outside node_modules and .git has changed for the number of days you choose (90 by default). SPACE256 checks again on disk right before anything moves.

Can I get a project's node_modules back?

Yes. It goes to the Trash, so you can put it back from SPACE256's Recovery. Or run the project's install again (npm install, yarn, or pnpm install).

Is there any risk?

Reinstalling downloads every package again and can take minutes. A package version that has been unpublished from the registry cannot be installed again, which is why these folders are never preselected.

Get SPACE256 at launch