Skip to main content
Version: 9.x

pnpm list

别名:ls

¥Aliases: ls

此命令将以树形结构输出已安装的软件包的所有版本及其依赖。

¥This command will output all the versions of packages that are installed, as well as their dependencies, in a tree-structure.

位置参数是 name-pattern@version-range 标识符,它将结果限制为仅指定的包。例如,pnpm list "babel-*" "eslint-*" semver@5

¥Positional arguments are name-pattern@version-range identifiers, which will limit the results to only the packages named. For example, pnpm list "babel-*" "eslint-*" semver@5.

选项

¥Options

--recursive, -r

在工作区中执行时,对子目录中的每个包或每个工作区包执行命令。

¥Perform command on every package in subdirectories or on every workspace package, when executed inside a workspace.

--json

JSON 格式的日志输出。

¥Log output in JSON format.

--long

显示扩展信息。

¥Show extended information.

--parseable

以可解析的格式输出包目录而不是树视图。

¥Outputs package directories in a parseable format instead of their tree view.

--global, -g

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

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

--depth <number>

依赖树的最大显示深度。

¥Max display depth of the dependency tree.

pnpm ls --depth 0(默认)将仅列出直接依赖。pnpm ls --depth -1 将仅列出项目。与 -r 选项一起使用时,在工作区内很有用。pnpm ls --depth Infinity 将列出所有依赖,无论深度如何。

¥pnpm ls --depth 0 (default) will list direct dependencies only. pnpm ls --depth -1 will list projects only. Useful inside a workspace when used with the -r option. pnpm ls --depth Infinity will list all dependencies regardless of depth.

--prod, -P

仅显示 dependenciesoptionalDependencies 中的包的依赖图。

¥Display only the dependency graph for packages in dependencies and optionalDependencies.

--dev, -D

仅显示 devDependencies 中包的依赖图。

¥Display only the dependency graph for packages in devDependencies.

--no-optional

不显示 optionalDependencies 的包。

¥Don't display packages from optionalDependencies.

--only-projects

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

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

--exclude-peers

添加于:v9.10.0

¥Added in: v9.10.0

从结果中排除对等依赖(但不会忽略对等依赖的依赖)。

¥Exclude peer dependencies from the results (but dependencies of peer dependencies are not ignored).

--filter <package_selector>

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

¥Read more about filtering.