{"library":"node-modules-inspector","title":"Node Modules Inspector","description":"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.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install node-modules-inspector"],"cli":{"name":"node-modules-inspector","version":null}},"imports":["import { run } from 'node-modules-inspector/cli';\n// Or, for direct CLI usage:\n// npx node-modules-inspector","import { analyzeProject } from 'node-modules-inspector/core';\n// For detailed analysis.","import type { ModuleReport } from 'node-modules-inspector/types';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { analyzeProject } from 'node-modules-inspector/core';\nimport path from 'node:path';\nimport process from 'node:process';\n\nasync function inspectCurrentProject() {\n  const projectPath = process.cwd();\n  console.log(`Analyzing node_modules in: ${projectPath}\\n`);\n\n  try {\n    // The `analyzeProject` function (inferred) would perform the core logic.\n    // In a real scenario, this might return a structured report object.\n    const report = await analyzeProject(projectPath, {\n      // Optional: Specify package manager if not auto-detected\n      packageManager: 'npm',\n      // Optional: Include dev dependencies in the analysis\n      includeDevDependencies: true,\n      // Optional: Filter modules based on criteria\n      filter: (module) => !module.name.startsWith('@types/'),\n    });\n\n    console.log('Analysis Complete! Key Insights:');\n    console.log(`Total unique packages: ${report.packages.length}`);\n    console.log(`Total disk size: ${report.totalSizeHumanReadable}`);\n    console.log(`Duplicate packages found: ${report.duplicates.length}`);\n    console.log(`Modules with known vulnerabilities: ${report.vulnerabilities?.length || 0}`);\n    console.log('\\nTo view the full interactive report, run:');\n    console.log('npx node-modules-inspector');\n\n  } catch (error) {\n    console.error(`Error during analysis: ${error.message}`);\n    console.error('Ensure you run this in a project with a node_modules directory.');\n    console.error('If this error persists, try running `npx node-modules-inspector` directly.');\n  }\n}\n\ninspectCurrentProject();","lang":"typescript","description":"This quickstart demonstrates how to programmatically analyze a project's `node_modules` directory and log summary information.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}