A VS Code extension that recursively finds and deletes all node_modules folders in your workspace. Optionally runs npm install to reinstall dependencies in all directories containing package.json files.
Features
🔍 Automatically finds all node_modules folders in your workspace
🗑️ Deletes all node_modules folders recursively
⚙️ Two operation modes:
Delete Only: Removes all node_modules folders without reinstalling
Delete and Reinstall: Removes node_modules and runs npm install in all directories with package.json
📝 Optional logging: Save a detailed log file of all operations to a text file
📊 Shows progress and summary of operations
⚠️ Asks for confirmation before proceeding
🌐 Works with workspaces, single folders, or no open folder (browse to select)
🖱️ Context menu integration: Right-click any folder in Explorer to quickly access the cleaner
Usage
Method 1: Command Palette
Press Ctrl+Shift+P (or Cmd+Shift+P on Mac) to open the Command Palette
Type "Clean and Reinstall Node Modules" and select it
Follow the prompts to select folder, operation type, and logging options
Method 2: Context Menu (Right-Click)
In the Explorer (file tree), right-click on any folder
Select "Clean and Reinstall Node Modules" from the context menu
The selected folder will be used automatically
Follow the prompts to select operation type and logging options
Operation Steps
After triggering the command (via Command Palette or Context Menu):
Select operation type:
Choose "Delete node_modules only" to remove folders without reinstalling
Choose "Delete and Reinstall" to remove folders and run npm install
Enable logging (optional):
Choose "Yes" to create a detailed log file in the target directory
Choose "No" to skip logging
Confirm the action when prompted
Wait for the process to complete
Review the summary (log file location will be shown if logging was enabled)
Log File
When logging is enabled, a text file is created in the target directory with:
Timestamp for each operation
All folders found and deleted
Success/failure status for each operation
npm install output (if reinstall option was selected)