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.

With Python or Cargo enabled, use pypi:<name> or crate:<name> to remove a dependency from pyproject.toml or Cargo.toml and update its lockfile. Package URLs such as pkg:pypi/example and pkg:cargo/example also work. Removing Python or Cargo dependencies requires exact names and does not support exclusions.

Patterns#

Added in: v12.23.0

A selector can be a glob pattern. A selector that starts with ! excludes the dependencies it matches, even ones named exactly. Quote patterns so the shell does not expand them.

pnpm remove "eslint-*" "!eslint-plugin-import"

A pattern that matches no dependency removes nothing and does not fail. An exact name that is not a dependency still fails with ERR_PNPM_CANNOT_REMOVE_MISSING_DEPS.

옵션#

--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>#

필터링에 대해 자세히 알아보세요.