Skip to main content

Description

Identifies packages that are imported in your code but not declared in your package.json dependencies. This helps ensure all required dependencies are properly documented.

Usage

rev-dep node-modules missing [flags]

Examples

# Find missing dependencies from a specific entry point
rev-dep node-modules missing --entry-points=src/main.ts

# Group results by file
rev-dep node-modules missing --group-by-file

# Group by module with file count
rev-dep node-modules missing --group-by-module-files-count

# Find missing dependencies with verbose output
rev-dep node-modules missing --verbose

Flags

--condition-names
strings
List of conditions for package.json imports resolution (e.g. node, imports, default)
-n, --count
boolean
Only display the count of modules
-c, --cwd
string
default:"$PWD"
Working directory for the command
-p, --entry-points
strings
Entry point file(s) to start analysis from (default: auto-detected)
-e, --exclude-modules
strings
List of modules to exclude from the output
-b, --files-with-binaries
strings
Additional files to search for binary usages. Use paths relative to cwd
-m, --files-with-node-modules
strings
Additional files to search for module imports. Use paths relative to cwd
--follow-monorepo-packages
strings
Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass package names
--group-by-file
boolean
Organize output by project file path
--group-by-module
boolean
Organize output by npm package name
--group-by-module-files-count
boolean
Organize output by npm package name and show count of files using it
-h, --help
boolean
Help for missing
-t, --ignore-type-imports
boolean
Exclude type imports from the analysis
-i, --include-modules
strings
List of modules to include in the output
--package-json
string
default:"./package.json"
Path to package.json
--pkg-fields-with-binaries
strings
Additional package.json fields to check for binary usages
--tsconfig-json
string
default:"./tsconfig.json"
Path to tsconfig.json
-v, --verbose
boolean
Show warnings and verbose output
--zero-exit-code
boolean
Use this flag to always return zero exit code

Use Cases

Dependency Validation

Ensure all imported packages are declared in package.json to prevent runtime errors.

Monorepo Management

Use --follow-monorepo-packages to properly resolve dependencies across workspace packages.

CI/CD Validation

Add to CI pipelines to catch missing dependencies before deployment.
Missing dependencies can cause runtime errors in production. Always add identified packages to your package.json dependencies.

Build docs developers (and LLMs) love