pnpm licenses

Aliases: licences

Checks the licenses of project dependencies.

pnpm licenses list

pnpm licenses without a subcommand fails with ERR_PNPM_LICENCES_NO_SUBCOMMAND.

命令#

list#

别名:ls

List licenses for project dependencies.

The command requires a pnpm-lock.yaml file. A workspace project not yet recorded in the lockfile has no licenses to list. When no licenses match, text output says No licenses in packages found and --json outputs {}.

When node_modules is absent, pnpm reads package metadata and license files from the configured store. Run pnpm fetch to populate the store from the lockfile. Packages missing from both the installation and the store are reported with an Unknown license.

Since v12.7.0, running pnpm licenses list inside a workspace project lists only that project's dependencies. Use --recursive or --filter to include other workspace projects.

A package resolved from a named registry is reported separately from a package of the same name and version that came from another registry. 注册源别名会显示在表格输出中包名旁边,并在使用 --json 时以 registryName 字段暴露。

配置项#

--recursive, -r#

List the licenses of the dependencies of every workspace project.

--dev, -D#

仅检查 "devDependencies"。

--json#

以 JSON 格式显示信息。

--long#

Show the author, description, and homepage of each package.

--no-optional#

不检查 optionalDependencies 中的软件包。

--optional, -O#

Check only optionalDependencies.

--prod, -P, --production#

仅检查 dependencies 和 optionalDependencies。

--filter <package_selector>#

阅读更多有关过滤的内容。