explaingit

voidcosmos/npkill

9,186TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Command-line tool that scans your computer for node_modules folders, shows how much disk space each one takes, and lets you delete old ones with a single keystroke.

Mindmap

mindmap
  root((npkill))
    What it does
      Scans node_modules
      Shows disk usage
      Deletes folders
    Features
      Multi-select mode
      Search filter
      Sort by size
    Usage
      npx npkill
      No install needed
    Audience
      JS developers
      Node.js users
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Free up gigabytes of disk space by deleting node_modules from old JavaScript projects you no longer use.

USE CASE 2

Bulk-delete groups of node_modules folders using multi-select and range selection in one step.

USE CASE 3

Sort project folders by size or last-modified date to identify the oldest unused ones first.

USE CASE 4

Run without installing anything by typing npx npkill in any terminal.

Tech stack

TypeScriptNode.js

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose including commercial, as long as you keep the copyright notice.

In plain English

Npkill is a command-line tool that scans your computer for node_modules folders and shows you how much disk space each one is taking up. Node_modules folders are directories that JavaScript and Node.js projects download to store their dependencies, and they can grow very large over time. On a machine with many old projects, these folders can collectively consume gigabytes of space even when you no longer use the projects. Once npkill lists the folders it finds, you navigate the list with arrow keys and press Space or Delete to remove whichever ones you want to clear out. The tool also shows when you last modified files in each project, which helps you identify old work you are unlikely to return to. You do not need to install the tool permanently: running npx npkill in a terminal is enough to use it. For situations where you want to clean up many folders at once, the tool has a multi-select mode. You can toggle it on, mark individual folders or use range selection to select a group, then delete them all in one step. There is also a search mode where you type a pattern to filter the list down to specific folders or paths. Additional options let you set where the scan starts, exclude certain directories, sort results by size or last-modified date, and choose which kinds of target directories to look for beyond just node_modules. The tool warns you if a folder belongs to a system-level application where deletion could cause problems. Npkill is written in TypeScript and has very few external dependencies. It is licensed under the MIT license.

Copy-paste prompts

Prompt 1
Using npkill's architecture, help me build a similar TUI tool in Python that finds and deletes old .venv Python virtual environment folders.
Prompt 2
I want to add a --days flag to npkill that automatically marks node_modules folders untouched for more than N days. Show me where in the TypeScript source to add this logic.
Prompt 3
Write a shell script that runs npkill in a monorepo and removes all node_modules folders before a fresh install, without any interactive prompts.
Prompt 4
How would I extend npkill to also scan for and display .cache and dist build artifact folders alongside node_modules?
Open on GitHub → Explain another repo

← voidcosmos on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.