Skip to content

nodehunterReclaim disk space from node_modules

A safety-first CLI for developers who manage many JavaScript projects — discover usage, measure physical disk cost, and delete only when you mean to.

nodehunter

Install

CLI (terminal):

bash
npm install -g nodehunter
# or: pnpm add -g nodehunter

SDK (embed in your app):

bash
npm install @nodehunter/core
# or: pnpm add @nodehunter/core

The nodehunter npm package ships a self-contained CLI (dist/cli.js — core is compiled in at build time, not a runtime dependency on @nodehunter/core). It also publishes a separate nodehunter/core export built from the same engine. For apps, libraries, and CI that import APIs, prefer @nodehunter/core on npm.

Both packages are on npm. Start with SDK examples for runnable scripts, or see the SDK overview for the host contract.

Quick start

bash
nodehunter                    # help (default — safe)
nodehunter scan ~/Projects    # discover node_modules (read-only)
nodehunter size ~/Projects    # physical disk totals + largest projects
nodehunter find react ~/Projects
nodehunter inspect ~/Projects --focus duplicates
nodehunter delete ~/Projects  # sized preview, then confirm (default no)

Start with scan and size on a scoped path. Use find, why, and inspect when you manage multiple repos or a monorepo. Reserve delete for after you have reviewed the preview.

Documentation

TopicWhat you will learn
WorkflowsAudit, investigate, and cleanup recipes
find · why · inspectCross-project workspace commands
CLI overviewCommand families and how flags are grouped
Discovery flags-p, -D, -i, -nd, -L
Global flags--json, --yes, cache, debug
Safety modelHow nodehunter prevents accidental deletion
CommandsPer-command reference
PlatformsWindows, macOS, Linux — du vs Node sizing
SDK@nodehunter/core — install and host contract
SDK examplesRunnable examples/sdk/ scripts
SDK exportsStability tiers and upgrade reports
JSON outputMachine-readable envelope for scripts and CI

Design principles

Safety-first by design. nodehunter separates finding from deleting. There is no config file to misconfigure — behavior is controlled by explicit commands and flags. Inspired by focused CLI tools like ripgrep and fd: a thin host, clear defaults, and no destructive surprises from aliases or implicit modes.