2025-12-16 10:20:31 -07:00
|
|
|
# npm explain
|
|
|
|
|
|
|
|
|
|
> Explain how a package is installed, detailing its dependencies and reasons for inclusion.
|
2026-02-18 06:55:01 -07:00
|
|
|
> More information: <https://docs.npmjs.com/cli/explain/>.
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Explain why a specific package is installed:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`npm {{[why|explain]}} {{package_name}}`
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Show explanation in JSON format:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`npm {{[why|explain]}} {{package_name}} --json`
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Include peer dependencies in the explanation:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`npm {{[why|explain]}} {{package_name}} --include peer`
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Limit explanation depth to 2 levels deep:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`npm {{[why|explain]}} {{package_name}} --depth 2`
|