Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Nifty Node Module CleanerNew to Visual Studio Code? Get it now.
Nifty Node Module Cleaner

Nifty Node Module Cleaner

jptaylor

|
2 installs
| (0) | Free
Clean and reinstall node_modules folders recursively
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Nifty Node Module Cleaner

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

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac) to open the Command Palette
  2. Type "Clean and Reinstall Node Modules" and select it
  3. Follow the prompts to select folder, operation type, and logging options

Method 2: Context Menu (Right-Click)

  1. In the Explorer (file tree), right-click on any folder
  2. Select "Clean and Reinstall Node Modules" from the context menu
  3. The selected folder will be used automatically
  4. Follow the prompts to select operation type and logging options

Operation Steps

After triggering the command (via Command Palette or Context Menu):

  1. Select operation type:
    • Choose "Delete node_modules only" to remove folders without reinstalling
    • Choose "Delete and Reinstall" to remove folders and run npm install
  2. Enable logging (optional):
    • Choose "Yes" to create a detailed log file in the target directory
    • Choose "No" to skip logging
  3. Confirm the action when prompted
  4. Wait for the process to complete
  5. 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)
  • Complete summary with statistics
  • Error messages (if any)

Log file format: node-modules-cleaner-log-YYYY-MM-DDTHH-MM-SS-sssZ.txt

Requirements

  • Node.js and npm must be installed and available in your PATH (only required for "Delete and Reinstall" option)
  • A workspace folder, single folder, or ability to browse and select a folder

Extension Settings

This extension does not add any VS Code settings.

Known Issues

  • Large node_modules folders may take some time to delete
  • If npm is not in your PATH, the installation step will fail (only affects "Delete and Reinstall" option)
  • Some folders may fail to delete if files are locked by other processes
  • npm warnings (deprecation notices) are normal and don't indicate failure

Release Notes

1.0.1

Initial release of Nifty Node Module Cleaner

  • Two operation modes: Delete only or Delete and Reinstall
  • Optional logging: Save detailed operation log to text file
  • Delete all node_modules folders recursively
  • Run npm install in all directories with package.json (optional)
  • Progress indicator and summary
  • Works with workspaces, single folders, or browse to select folder
  • Cross-platform support (Windows, Mac, Linux)
  • Update Readme

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft