pnpm remove

Aliases: rm, uninstall, un, uni

从 node_modules 和 package.json 中删除软件包。

pnpm remove <pkg>...

Without a --save-* option, the package is removed from every dependency field.

配置项#

--recursive, -r#

当在 工作空间 中使用时,从每个工作空间包中除去一个(或多个)依赖关系 。

当不在工作空间内使用时,将在子目录中找到的每个包中删除一个(或多个)依赖。

--global, -g#

Remove a global package and unlink its bins from the global bin directory.

--save-dev, -D#

仅从 devDependencies 中删除依赖项。

--save-optional, -O#

仅从 optionalDependencies 中删除依赖项。

--save-prod, -P#

仅从 dependencies 中删除相关依赖项。

--lockfile-only#

Update package.json and pnpm-lock.yaml without changing node_modules.

--lockfile-dir <dir>#

The directory in which pnpm-lock.yaml is created. It cannot be combined with --global.

--[no-]trust-lockfile#

Added in: v12.3.0

Removing a package rewrites the lockfile, so pnpm remove verifies the whole lockfile against the active policies the way pnpm install does, not only the entries of the package being removed. --trust-lockfile skips that pass, as the trustLockfile setting does. --no-trust-lockfile verifies the lockfile even when the configuration trusts it.

The policy settings also take their pnpm install spellings here: --trust-policy, --trust-policy-exclude, and --trust-policy-ignore-after.

--filter <package_selector>#

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