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

@zandd/pnm

v1.0.1

Published

A CLI tool to purge node_modules directories and free up disk space

Readme

PNM - Purge Node Modules 🧹

A powerful CLI tool to find and delete node_modules directories, helping you reclaim valuable disk space.

Features

  • 🔍 Recursive Scanning: Finds all top-level node_modules directories in a given path
  • 📊 Detailed Analysis: Shows total space to be freed, number of files, and directory count
  • Safe Deletion: Requires confirmation before deleting (unless using -y flag)
  • 🎯 Dry Run Mode: Preview what would be deleted without actually deleting
  • 🎨 Beautiful CLI: Colorful output with progress indicators
  • Fast: Efficient scanning and deletion process

Installation

Global Installation (Recommended)

npm install -g @zandd/pnm

Use with npx (No Installation Required)

npx @zandd/pnm [path]

Usage

Basic Usage

Scan and clean the current directory:

pnm

Scan and clean a specific directory:

pnm /path/to/your/projects

Options

pnm [path] [options]

Options:

  • -t, --test - Show directory size and potential cleanup without deleting
  • -d, --delete - Delete node_modules directories
  • -r, --restore - Run npm install to restore packages in all projects (works independently)
  • -y, --yes - Skip confirmation and delete immediately
  • -V, --version - Output the version number
  • -h, --help - Display help information

Examples

Test to see potential space savings (safe):

pnm ~/projects --test

Delete node_modules directories:

pnm ~/projects --delete

Delete without confirmation:

pnm ~/projects --delete --yes

Delete and restore packages:

pnm ~/projects --delete --restore

Just restore packages (without deleting):

pnm ~/projects --restore

Scan current directory:

pnm .

Output Example

🔍 PNM - Purge Node Modules

Scanning for node_modules directories in: C:\Users\Dev\Projects

✓ Found 15 node_modules directories

Analyzing directories...

✓ Analysis complete

Summary:
  📁 Directories found: 15
  📄 Total files: 245,832
  💾 Space to be freed: 2.4 GB

Directories to be deleted:
  1. C:\Users\Dev\Projects\project1\node_modules
  2. C:\Users\Dev\Projects\project2\node_modules
  ...

? Are you sure you want to delete 15 node_modules directories? (y/N)

✓ Deleted 15 directories

✓ Successfully deleted all node_modules directories!
  💾 Space freed: 2.4 GB
  📄 Files removed: 245,832

How It Works

  1. Scanning: Recursively scans the specified directory for node_modules folders
  2. Analysis: Calculates the total size and file count of all found directories
  3. Summary: Displays a detailed summary of what will be deleted
  4. Confirmation: Asks for user confirmation (unless --yes flag is used)
  5. Deletion: Safely removes all node_modules directories
  6. Report: Shows the final statistics of freed space and removed files

Development

Setup

# Clone the repository
git clone https://github.com/zandd/pnm.git
cd pnm

# Install dependencies
npm install

# Run locally
npm start

Scripts

  • npm start - Run the CLI tool

Contributing

This repository is open for downloads and forks only. Pull requests are not accepted.

Feel free to fork this project and customize it for your own needs!

License

MIT License - see LICENSE file for details

Repository

Author

zandd

Changelog

1.0.0

  • Initial release
  • Recursive scanning for node_modules directories
  • Size and file count analysis
  • Safe deletion with confirmation
  • Dry run mode
  • Colorful CLI interface

⚠️ Warning: This tool permanently deletes directories. Always review the summary before confirming deletion. Use --dry-run first if you're unsure.