Skip to main content
Version: 9.x

pnpm why

显示依赖于指定包的所有包。

¥Shows all packages that depend on the specified package.

提醒

如果依赖树的结果(结束叶)超过 10 个,则输出将被截断为 10 个结束叶。

¥If the Dependencies Tree has more than 10 results (end leaves), the output will be truncated to 10 end leaves.

这使得输出更具可读性并避免内存问题。

¥This makes the output more readable and avoids memory issues.

选项

¥Options

--recursive, -r

在工作区中执行时,显示子目录中每个包或每个工作区包上指定包的依赖树。

¥Show the dependency tree for the specified package on every package in subdirectories or on every workspace package when executed inside a workspace.

--json

以 JSON 格式显示信息。

¥Show information in JSON format.

--long

显示详细输出。

¥Show verbose output.

--parseable

显示可解析的输出而不是树视图。

¥Show parseable output instead of tree view.

--global, -g

列出全局安装目录中的包,而不是当前项目中的包。

¥List packages in the global install directory instead of in the current project.

--prod, -P

仅显示 dependencies 中包的依赖树。

¥Only display the dependency tree for packages in dependencies.

--dev, -D

仅显示 devDependencies 中包的依赖树。

¥Only display the dependency tree for packages in devDependencies.

--depth <number>

仅显示特定深度内的依赖。

¥Display only dependencies within a specific depth.

--only-projects

仅显示也是工作区中的项目的依赖。

¥Display only dependencies that are also projects within the workspace.

--filter <package_selector>

了解有关过滤的更多信息。

¥Read more about filtering.