← 返回命令列表

Linux command

npm-why 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Explain why a package is installed

npm why [package-name]

Explain a specific version

npm why [package-name]@[version]

JSON output

npm why [package-name] --json

Limit depth

npm why [package-name] --long

Target a specific workspace

npm why [package-name] --workspace=[workspace-name]

说明

npm why shows why a package is installed. Alias for npm explain. The command traces dependency paths. Shows all routes to package.

参数

--json
Output results in JSON format.
--long
Show extended information.
--workspace _NAME_
Limit to a named workspace or path.
--include-workspace-root
Include root project in addition to workspaces.
--help
Display help information.

FAQ

What is the npm-why command used for?

npm why shows why a package is installed. Alias for npm explain. The command traces dependency paths. Shows all routes to package.

How do I run a basic npm-why example?

Run `npm why [package-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --json do in npm-why?

Output results in JSON format.