Node Modules Inspector is an interactive command-line interface (CLI) and web UI tool designed for comprehensive analysis and visualization of the `node_modules` directory within JavaScript/TypeScript projects. Maintained by Anthony Fu, the package is currently at version 1.4.2 and receives regular updates, as indicated by its recent feature and bugfix releases. It helps developers understand their project's dependency graph, identify installed dependencies, analyze package sizes, detect module types (ESM vs. CJS), and locate duplicates or version conflicts. The tool differentiates itself by offering an interactive UI that can be launched locally or built into a static report for hosting, supporting various package managers including npm, pnpm, and Bun. It is particularly useful for debugging dependency issues, optimizing bundle sizes in large projects or monorepos, and quickly assessing potential vulnerabilities through its report view.
npm install node-modules-inspectorVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically analyze a project's `node_modules` directory and log summary information.
Prefer `npx node-modules-inspector` for interactive analysis. If integrating programmatically, refer to the package's source or examples for exact API details, as it may evolve.
For non-interactive or deployable reports, run `npx node-modules-inspector build`. The output will be in a `.node-modules-inspector` folder which can then be served as static files.
Ensure your `node_modules` is in a clean state by running `rm -rf node_modules && [your-package-manager] install` before using the inspector. This helps guarantee an accurate reflection of your project's dependencies.
Upgrade to `node-modules-inspector@latest` (or >=1.4.0) to benefit from the integrated vulnerability scanning in the report UI.
Ensure you are using correct ESM import paths (e.g., `import { run } from 'node-modules-inspector/cli';`) and that your project supports ESM. For direct CLI usage, prefer `npx node-modules-inspector`.Add checks for `report` and its properties being defined before accessing them. Ensure your project has a `node_modules` directory and dependencies are installed. Log the `report` object to inspect its structure if the issue persists.
Ensure `npm` is correctly installed and its bin directory is in your system's PATH. You can also try installing the package globally first: `npm install -g node-modules-inspector`, then run `node-modules-inspector`.
No dependency data recorded yet.