better-npkill
v1.0.2
Published
A fast, non-freezing CLI to find and delete dependency folders (npm, pnpm, yarn, bun) — a better npkill
Maintainers
Readme
better-npkill
Fast CLI to find and delete dependency folders across JavaScript projects.
- Works with npm, pnpm, yarn, and bun
- Lists only parent dependency folders (no nested
node_modules/.../node_modulesnoise) - Interactive TUI with multi-select, filtering, sorting, and safe delete options
- JSON mode for scripts and automation
Quick Start
Run without global install:
npx better-npkill@latestOther runtimes:
bunx better-npkill@latest
pnpm dlx better-npkill@latestInstall
Optional global install:
npm install -g better-npkill@latestThen run:
better-npkillUsage
# Current directory
better-npkill
# Specific root
better-npkill ~/dev
# Include package-manager caches as well
better-npkill ~/dev --pattern deps
# Only folders >= 100MB
better-npkill ~/dev --min-size 100MB
# Only folders older than 30 days
better-npkill ~/dev --older-than 30d
# Skip confirmation
better-npkill ~/dev --yes
# Move to trash instead of permanent delete
better-npkill ~/dev --trash
# Simulate delete
better-npkill ~/dev --dry-run
# Non-interactive JSON output
better-npkill ~/dev --jsonCLI Options
| Flag | Description |
| ------------------------- | ------------------------------------------------------ |
| [rootDir] | Directory to scan (default: current working directory) |
| --pattern <name> | Folder pattern or alias (deps), repeatable |
| --min-size <size> | Minimum size, e.g. 100MB, 1.5GB |
| --older-than <duration> | Minimum age, e.g. 30d, 12h |
| --dry-run | Simulate deletion |
| --yes | Skip confirmation |
| --trash | Move to system trash |
| --json | Print results as JSON and exit |
| -h, --help | Show help |
| -v, --version | Show version |
Patterns
| Pattern / alias | Default | Description |
| ----------------------------- | --------------- | --------------------------------------------- |
| node_modules | yes | Dependency folder (npm, pnpm, yarn, bun) |
| deps | via --pattern | Alias: node_modules, .yarn, .pnpm-store |
| .yarn | via --pattern | Yarn Berry cache |
| .pnpm-store | via --pattern | pnpm store (local setups) |
| .next | via --pattern | Next.js build cache |
| dist, build | via --pattern | Build output folders |
| .expo, android, .gradle | via --pattern | Expo / Android tooling folders |
Keybinds
| Key | Action |
| ---------------------- | -------------------------------- |
| ↑ / ↓ or j / k | Move cursor |
| Space | Toggle selection |
| a | Select all visible |
| / | Filter by path |
| s | Cycle sort (size / path / mtime) |
| Enter or D | Delete selected (or focused row) |
| ? | Toggle help |
| q | Quit |
Confirm dialog: y to confirm, n to cancel.
Requirements
- Node.js 20+
