A powerful and safe Bash script to clean up node_modules directories and package-lock.json files from your Node.js projects. Perfect for developers who want to free up disk space and start fresh with their dependencies.
- 🔍 Smart Scanning: Recursively scans for
node_modulesdirectories andpackage-lock.jsonfiles - 📊 Detailed Summary: Provides a comprehensive overview of what will be removed
⚠️ Safety First: Interactive confirmation before any deletion- 📈 Progress Tracking: Real-time progress bar during removal process
- 📋 Completion Report: Detailed summary of successful and failed removals
- 🚀 Fast & Efficient: Optimized for performance on large project structures
- Bash shell (Linux, macOS, or WSL on Windows)
- Basic terminal knowledge
-
Clone the repository:
git clone https://github.com/RonakShishangia/remove-node-modules.git cd remove-node-modules -
Make the script executable:
chmod +x remove_node_modules.sh
Run the script in your project root or any directory containing Node.js projects:
./remove_node_modules.shThe script will:
- Scan the current directory and subdirectories
- Display a summary of found
node_modulesdirectories andpackage-lock.jsonfiles - Ask for your confirmation
- Remove the files/directories with a progress bar
- Provide a completion report
╔══════════════════════════════════════════════════════════════╗
║ NODE_MODULES REMOVAL SCRIPT ║
╚══════════════════════════════════════════════════════════════╝
🔍 Scanning for node_modules directories...
🔍 Scanning for package-lock.json files...
📊 SCAN RESULTS:
Total node_modules directories found: 3
Total package-lock.json files found: 2
📁 Directories to be removed:
1) ./project1/node_modules
2) ./project2/node_modules
3) ./project3/node_modules
⚠️ WARNING: This will permanently delete the above directories and files!
Continue with removal? (y/N): y
🗑️ REMOVING DIRECTORIES...
Removing: ./project1/node_modules [####################] 100%
✅ Removed successfully
...
This script permanently deletes files and directories. Always:
- Backup important data before running
- Double-check the scan results
- Use in development environments only
- Avoid running on production systems
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
git clone https://github.com/RonakShishangia/remove-node-modules.git
cd remove-node-modules
# Make your changes
# Test thoroughly
# Submit PRThis project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the common need to clean up Node.js project dependencies
- Built with love for the developer community
Made with ❤️ by Ronak Shishangia