Explain why a dependency is installed
Read-only
What do risk levels mean?
- Read-only
- Inspects state without changing anything.
- Low risk
- Reversible with a routine follow-up command.
- Medium risk
- Changes state; undo path documented.
- Destructive
- Deletes or overwrites; confirmation required.
Traces the dependency chain that caused a package to be installed without changing the lockfile or node_modules.
nodenpmdependency-tree
Parameters
Installed npm package name to trace.
Commands
Show which direct or transitive dependencies require the package
npm explain "<package>"Verification
npm explain "<package>"npm prints one or more dependency paths, or reports that the package is not installed.
Undo
Not undoable
This recipe only reads dependency relationships and changes nothing.
Pitfalls
- Run the command from the package root so npm uses the intended dependency tree.