Developers · node_modules folders

Is it safe to delete node_modules folders?

Safe to removeComes back on its ownTypical size: 100 MB–2 GB per project
…/node_modules

Anywhere in your projects: a “node_modules” folder next to “package-lock.json”, “yarn.lock”, “pnpm-lock.yaml”, “bun.lock”, “bun.lockb”.

Updated October 17, 2026By the MoreRoom team, Yando Pte. Ltd.This page as Markdown

The short answer

Yes. Rebuilt or re-downloaded automatically when needed.

What is it?

A node_modules folder holds the packages a JavaScript or TypeScript project installed with npm, Yarn, pnpm or Bun. Only folders next to a lockfile (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lock or bun.lockb) in projects not touched for 30 days are considered, so the exact versions can be restored. Each one is typically 100 MB to over 1 GB.

Installed dependencies of projects not touched for 30 days. Restored with npm install (or yarn, pnpm, bun).

What happens if you delete it?

Running npm install (or npm ci, yarn, pnpm install, bun install) in the project rebuilds the folder from the lockfile, which takes a minute or two and some bandwidth. Your source code is not affected.

How to remove it properly

Move the node_modules folder to the Trash in Finder, or run rm -rf node_modules in the project folder (permanent). Tools such as npx npkill list them across all projects.

Quit the app that uses it, then move it to the Trash. Empty the Trash when you’re sure.

  • MoreRoom only suggests items unused for 30 days or more.

Before you delete it

If you edited files inside node_modules by hand (a local patch without patch-package), those edits are lost.

How MoreRoom helps

MoreRoom recognises this item, shows its real size and when it was last used, and labels it “Safe to remove”. In the free version you can move it to the Trash in one click, with Undo; Pro collects every safe item at once.

Frequently asked questions

Is it safe to delete node_modules folders?

Yes. Rebuilt or re-downloaded automatically when needed. Running npm install (or npm ci, yarn, pnpm install, bun install) in the project rebuilds the folder from the lockfile, which takes a minute or two and some bandwidth. Your source code is not affected.

Will node_modules folders come back after I delete it?

Yes. Running npm install (or npm ci, yarn, pnpm install, bun install) in the project rebuilds the folder from the lockfile, which takes a minute or two and some bandwidth. Your source code is not affected.

How do I remove node_modules folders properly?

Move the node_modules folder to the Trash in Finder, or run rm -rf node_modules in the project folder (permanent). Tools such as npx npkill list them across all projects.

Guides that mention it

Related folders