node_modules cleanup

Clean node_modules on Mac safely.

Short answer: You can usually delete node_modules because package managers can recreate it, but you should review the project path first and use Trash instead of permanent deletion.

What is node_modules?

node_modules stores installed JavaScript dependencies for npm, Yarn, and pnpm projects. A Mac with many JavaScript projects can easily have many separate copies of dependency folders.

When is it safe to remove?

It is usually safe when the project has dependency files such as package.json, package-lock.json, yarn.lock, or pnpm-lock.yaml. Recreate the folder later with the package manager used by that project.

How DevClean helps

DevClean finds node_modules folders inside the folders you choose, shows size and full path, lets you unselect anything you want to keep, and moves selected folders to Trash by default.

Related guides