npm-exorcist
v1.0.0
Published
Hunt down and banish forgotten node_modules folders haunting your disk — interactively and safely.
Maintainers
Readme
npm-exorcist
The power of Christ compels your
node_modulesto leave.
Your disk is haunted. Somewhere deep in your home directory, dozens of forgotten node_modules folders are lurking in the shadows, whispering "544MB" in the dark. That side project from 2019? Still there. That tutorial you followed once? Possessed by 1,200 transitive dependencies.
npm-exorcist scans your filesystem, finds every node_modules infestation, and lets you banish them one by one — safely, interactively, and with the drama they deserve.
What it does
- Crawls your home directory (or a path you specify) looking for
node_modulesfolders - Only finds top-level ones — it won't descend into the
node_modulesabyss withinnode_modules(there are some places even exorcists won't go) - Skips system folders (
Library,AppData,Windows) and hidden folders (dotfiles have enough problems already) - Asks how you want to banish them:
- Move to Trash — safe, recoverable. Changed your mind? Fish it out. Even exorcists believe in second chances.
- Permanent delete (rm -rf) — faster, irreversible. For when you're sure the demons must not return.
- Shows you each possessed project: its package name, path, and size
- Asks: "Delete this node_modules?" — you decide who lives and who gets banished
- At the end, tells you how much disk space you reclaimed from the darkness
Install
npm install -g npm-exorcistOr just run it directly from the project folder:
node index.jsUsage
# Exorcise from your home directory (the default hunting ground)
npm-exorcist
# Exorcise a specific directory
npm-exorcist ~/ProjectsThen follow the prompts. Press y to banish, n to show mercy, or Ctrl+C to flee the scene entirely.
Example
┌ npm-exorcist
│
◆ How do you want to remove node_modules?
│ ● Move to Trash (safe, recoverable)
│ ○ Permanent delete (rm -rf) (faster, not recoverable)
│
◇ Found 14 node_modules folder(s). Calculating sizes...
│
◇ Total: 14 folders, 3.2G
│
◆ [1/14] my-abandoned-startup (812.4M)
│ ~/Projects/my-abandoned-startup/node_modules
│
│ Delete this node_modules?
│ ● Yes ○ No
│
└ Done. Deleted 11/14 node_modules folders, freed ~2.8G.Requirements
- macOS, Windows, or Linux — the demons are everywhere, and so are we
- Node.js >= 18
Why not just rm -rf?
You can! npm-exorcist now gives you the choice. But the Trash option is the default for a reason — it's reversible. The rm -rf option is there for when you're sure, you're in a hurry, or you just enjoy living dangerously.
FAQ
Q: Will this delete my project?
A: No. Only the node_modules folder. Your code is safe. Your code was always the real problem anyway.
Q: Can I get my node_modules back?
A: If you chose Trash, yes — check your Trash. If you chose permanent delete... npm install like the rest of us.
Q: How did I have 8GB of node_modules? A: You know exactly how. We all do.
