Find and delete node_modules directories across your entire machine β fast,
safe, and without leaving your terminal.
Inspired by npkill but rewritten from scratch in Rust, with a focus on speed, safety, and a polished user experience.
Personal note:
I originally wrote this tool as a simple script. However, when I decided to add a terminal UI and improve code readability, it turned into a complete nightmare and took much longer than expected. I ended up using AI to handle the refactoring, TUI implementation, and documentation. If you find anything strange or suboptimal, please feel free to open an issue or a PR to help improve it.
The fastest way to try it. Works on any machine with Node.js installed.
npx killnode
npx killnode ~/projectsnpm install -g killnodebrew tap shacript/killnode
brew install killnodeDownload the binary for your platform from the
Releases page and put it
somewhere on your PATH.
| Platform | File |
|---|---|
| macOS β Apple Silicon | killnode-aarch64-apple-darwin |
| macOS β Intel | killnode-x86_64-apple-darwin |
| Linux β x64 | killnode-x86_64-unknown-linux-musl |
| Linux β arm64 | killnode-aarch64-unknown-linux-musl |
| Windows β x64 | killnode-x86_64-pc-windows-msvc.exe |
killnode # scan the current directory
killnode ~/projects # scan a specific directory
killnode --help # print usage
killnode --version # print versionkillnode scans the path you give it (or . if you don't give one), finds
every node_modules directory, and presents them in a list. From there you
pick what to delete and confirm. That's it.
killnode automatically detects directories that look like they might be managed
by an application or the operating system. These entries are marked with a red
β in front of their path and are not pre-selected.
You can still select sensitive entries manually with Space, or include all of
them at once with A. When at least one sensitive entry is selected, the
confirmation popup shows a warning before anything is deleted.
The detection rules are intentionally conservative. It is better to flag something as sensitive and let you handle it manually than to silently delete something load-bearing.
Locations that are always flagged:
~/.config/**β application configuration~/.local/share/**β XDG application data~/.cache/**β caches managed by other tools- Any other hidden top-level directory under
~(e.g.~/.myapp) /Applications/Foo.app/**β macOS application bundlesAppData\Roaming\**β Windows roaming application dataAppData\Local\**β Windows local application data (with exceptions below)- UNC network paths containing hidden directory segments
Locations that look sensitive but are safe to delete:
~/.npmand~/.pnpmβ package manager download caches; deleting them just means the next install re-downloads packagesAppData\Local\.cache,AppData\Local\.npm,AppData\Local\.pnpmβ same reasoning on Windows
You need a Rust toolchain (stable, 1.85 or newer).
git clone https://github.com/shacript/killnode
cd killnode
cargo build --release
./target/release/killnodeTo install it to your Cargo bin directory:
cargo install --path .MIT
