@tahsin005/node-snap
v0.0.3
Published
Recursively find and delete node_modules
Maintainers
Readme
node-snap (Node Modules Cleaner)
A simple and efficient CLI tool to recursively find and delete node_modules directories from your project and all its subdirectories.
Description
node-snap helps developers clean up their projects by removing all node_modules folders. It starts from the current working directory and recursively searches through all subdirectories to locate and delete any node_modules it finds — freeing up disk space and preparing projects for archiving or sharing.
Runs in auto mode by default (no prompts), or in interactive mode with -it for per-folder confirmation.
Installation
Install globally via npm:
npm install -g node-snapOr run directly with npx:
npx node-snapUsage
node-snap [options]| Option | Description |
|---|---|
| (none) | Auto mode — silently deletes all node_modules found |
| -it | Interactive mode — prompts before each deletion |
| -h, --help | Show the help manual and exit |
Auto Mode
Scans and deletes everything without any prompts:
node-snap--- Node Modules Cleaner (node-snap) ---
Scanning: /home/user/projects
Deleting: /home/user/projects/app/node_modules
Deleting: /home/user/projects/old-project/node_modules
[node-snap] Success: All node_modules removed.Interactive Mode (-it)
Pauses at each found folder and asks for confirmation:
node-snap -it--- Node Modules Cleaner (node-snap) ---
Mode: Interactive (-it)
Scanning: /home/user/projects
Found: /home/user/projects/app/node_modules
Delete? [Y/n] y
Deleting: /home/user/projects/app/node_modules
Found: /home/user/projects/old-project/node_modules
Delete? [Y/n] n
Skipped.
[node-snap] Success: All node_modules removed.Accepted inputs:
| Action | Input |
|---|---|
| ✅ Confirm | y, Y, yes, YES, Yes — or just press Enter |
| ❌ Skip | n, N, no, NO, No |
Help
node-snap --help
# or
node-snap -hFeatures
- Recursive Deletion — cleans
node_modulesfrom the current directory and all subdirectories - Interactive Mode — optional per-folder confirmation with
-it - Smart Skipping — hidden directories (dot folders) are always ignored
- Colored Output — clear visual feedback with colored status messages
- Graceful Error Handling — handles permission errors and missing directories without crashing
- Zero Dependencies — lightweight with no external dependencies
Warning
⚠️ This tool permanently deletes directories and their contents.
While node_modules can always be restored with npm install, use -it (interactive mode) if you want to review each folder before deletion.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License — see the LICENSE file for details.
