pnpm why
显示依赖于指定包的所有包。
🌐 Shows all packages that depend on the specified package.
输出是一个反向依赖树:被搜索的包出现在根节点,其依赖它的包作为分支,一直追溯到工作区根目录。
🌐 The output is a reverse dependency tree: the searched package appears at the root, with its dependents as branches, walking back to workspace roots.
输出中重复的子树会被去重,并显示为“去重”.
🌐 Duplicate subtrees are deduplicated in the output and shown as "deduped".
选项
🌐 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.
--exclude-peers
从结果中排除对等依赖(但不会忽略对等依赖的依赖)。
🌐 Exclude peer dependencies from the results (but dependencies of peer dependencies are not ignored).
--filter <package_selector>
--find-by <finder_name>
新增于:v10.16.0
🌐 Added in: v10.16.0
使用在 .pnpmfile.mjs 中定义的 finder function 来根据除名称以外的属性匹配依赖。
🌐 Use a finder function defined in .pnpmfile.mjs to match dependencies by properties other than name.