npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-modules-deleter

v1.0.3

Published

CLI tool to delete node_modules directories

Readme


🧹 Node Module Deleter

A command-line interface (CLI) tool to help you find and delete node_modules directories in your projects, freeing up valuable disk space.

` Node modules can consume a significant amount of disk space, especially if you work with many JavaScript projects. This tool provides an easy way to locate these directories and either delete them all at once or selectively choose which ones to remove.

✨ Features

  • Scan for all node_modules directories: Recursively searches the current directory for all node_modules folders.
  • List directories with their size and path: Provides details about each found node_modules directory when using the --list option.
  • Interactively select directories to delete: Choose specific node_modules folders to remove from a list.
  • Bulk deletion: Option to delete all found node_modules directories in one go.
  • Calculates freed space: Shows you how much disk space you've reclaimed after deletion.
  • Graceful exit: Handles Ctrl+C gracefully.

🚀 Installation

You can install this CLI tool using npm:

npm install node-modules-deleter

For global install:

npm install -g node-modules-deleter

If you're running it locally from the source, you can simply execute it using node:

# Navigate to the directory containing the script
node index.js [command] [options]

💡 Usage

The primary command is scan, which searches for node_modules directories.

nmd scan [options]

Options

  • -v, --version: Show version number.
  • --list: List all found node_modules directories with their size and path, and allow interactive selection for deletion.

Examples

1. Scan and Delete All node_modules

To scan the current directory and be prompted to delete all found node_modules directories:

nmd scan

You will see output similar to this:

Scanning for 'node_modules' directories.
✔ Scanning...
Found 3 'node_modules' directories.
? Do you want to delete all the found node_modules directories? (y/N)

If you confirm, all found node_modules folders will be deleted.

2. Scan and Interactively Select node_modules to Delete

To scan and get a list of all node_modules directories, allowing you to pick which ones to delete:

nmd scan --list

This will output a list and prompt you for selection:

Scanning for 'node_modules' directories.
✔ Scanning...
Found 3 'node_modules' directories:
? Select node_modules directories to delete: (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to continue)
 ◯ /Users/username/projects/project1/node_modules
 ◯ /Users/username/projects/project2/frontend/node_modules
 ◯ /Users/username/projects/project3/backend/node_modules

Use the spacebar to select individual directories, or a to toggle all, then press enter to proceed with deletion.

3. Show Version

To check the version of the CLI tool:

nmd -v
# or
nmd --version