pnpm update
별칭: up, upgrade
pnpm update는 지정된 범위를 기준으로 패키지를 최신 버전으로 업데이트합니다.
인수 없이 사용하면, 모든 의존성을 업데이트합니다.
요약#
| 명령어 | 의미 |
|---|---|
pnpm up |
package.json에 지정된 범위를 준수하여 모든 종속성을 업데이트합니다 |
pnpm up --latest |
모든 종속성을 최신 버전으로 업데이트합니다 |
pnpm up --tag next |
Updates all dependencies to the versions behind their next tags |
pnpm up foo@2 |
최신 v2 버전으로 foo를 업데이트합니다 |
pnpm up "@babel/*" |
@babel 스코프 아래의 모든 종속성을 업데이트합니다 |
업데이트가 기록하는 내용#
Besides moving pnpm-lock.yaml to the newly resolved versions, pnpm update writes the new range back to the place the dependency is declared:
- In
package.json, the range is moved onto the resolved version while the operator the dependency already declared is kept, so^1.1.0stays a caret range. - A dependency declared through the
catalog:protocol is not rewritten inpackage.json. The catalog entry it points at is updated instead, inpnpm-workspace.yaml. - A dependency declared through the
jsr:protocol keeps itsjsr:prefix, and its range moves like an npm range. - A dependency declared through a dist-tag, such as
"foo": "latest", keeps tracking the tag. The tag stays inpackage.jsonand only the lockfile moves to the version behind it, with--latestas well. - Since v12.12.0, a config dependency is updated too, and its new range is written to
pnpm-workspace.yaml. - A runtime (
node,deno,bundeclared indevEngines.runtime,engines.runtime, or through theruntime:/tool:protocol) and a package manager (pnpm,npm,yarn,bundeclared indevEngines.packageManagerorpackageManager) are updated too, and their new versions or ranges are written back topackage.json(andpnpm-lock.yamlwhen the pin is recorded there). A Node.js runtime range such as>=20 <23keeps its bounds when the updated stable version satisfies it. Anengines.pnpmrange moves with the pnpm pin, the waypnpm self-updatemoves it. - When
cargo.enabledistrue, Cargo dependencies inCargo.tomlandCargo.lockare updated too. Passcrate:<name>(orcrate:<name>@<req>) to target specific crates. - Since v12.25.0, when
cargo.enabledistrue,--latestalso moves the Rust release that a toolchain file pins. Passrustto update only the toolchain, or!rustto leave it out. The toolchain counts as a dev dependency, andupdateConfig.ignoreDependenciescan hold it back. - When
python.enabledistrue, Python dependencies inpyproject.tomlandpylock.tomlare updated too. Passpypi:<name>(orpypi:<requirement>) to target specific Python distributions.
Recursive and filtered updates include standalone Python and Cargo workspace members. Python name patterns ignore case and treat runs of dots, underscores, and hyphens as one hyphen. Cargo selectors match both the dependency alias and the crate name.
- Since v12.6.0, a dependency whose specifier comes from a
packageExtensionsentry, areadPackagehook, or anoverrideis not written topackage.json. The lockfile keeps that specifier.pnpm updateandpnpm audit --fix=updatestill move it inside the range.
An exact pin from one of those sources is left as it is. When that pin is a vulnerable version, pnpm audit --fix=update warns and points at pnpm audit --fix, which writes an override. An override is applied after packageExtensions and readPackage, so it replaces a specifier those supply.
Pass --no-save to update the lockfile only and leave the declared ranges alone.
Since v12.0.0, --patches does something different
from all of this: it changes no version and no declared range, refreshing only
which registry artifact each locked version resolves to. That still rewrites
lockfile metadata (the integrity, the revision, and the package snapshot
around them), because artifact revisions may declare different dependencies. See
Registry revisions.
Updating to a specific version#
In manual catalog mode, pnpm update foo@2.0.0 moves a shared catalog entry from ^1.0.0 to ^2.0.0. If you request a range, pnpm writes that range to the catalog entry. A version or range update fails if the entry points to a local directory.
pnpm update <name>@<version> fails with ERR_PNPM_UPDATE_VERSION_ON_INDIRECT_DEP when the package is not a direct dependency of any selected project. There is nowhere to record the version in that case; pin a transitive dependency through overrides instead. Ranges and tags are unaffected.
패턴으로 종속성 선택하기#
패턴을 사용하여 특정 의존성을 업데이트할 수 있습니다.
모든 babel 패키지 업데이트:
pnpm update "@babel/*"
webpack을 제외한 모든 종속성 업데이트:
pnpm update "\!webpack"
패턴을 조합할 수도 있으므로, 다음 명령은 core를 제외한 모든 babel 패키지를 업데이트합니다:
pnpm update "@babel/*" "\!@babel/core"
GitHub Actions 업데이트하기#
pnpm outdated는 저장소의 워크플로 파일에서 참조하는 GitHub Actions의 업데이트를 확인할 수 있으며, pnpm update는 이를 업데이트할 수 있습니다. 이 기능은 모든 명령에서 옵트인 방식입니다: --include-github-actions를 전달하거나, 기본적으로 활성화하려면 pnpm-workspace.yaml에서 update.githubActions를 true로 설정하세요.
업데이트된 액션은 정확한 커밋 해시로 고정되며, 릴리스 태그는 주석으로 보존됩니다:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Local actions are followed rather than looked up: a ./-relative reference, and
since v12.3.0 GitHub's self-repository spelling
(uses: $/.github/actions/setup), resolve inside the repository.
업데이트 확인은 참조된 모든 저장소에 대해 git ls-remote를 실행합니다. Actions whose refs cannot be read (for example, an action in a private repository) are skipped with a warning. If the actions are hosted on a different GitHub server (such as a GitHub Enterprise Server), set update.githubActionsServer.
옵션#
--recursive, -r#
package.json이 있는 모든 하위 디렉터리에서 동시에 업데이트를 실행합니다(node_modules 제외).
사용 예:
pnpm --recursive update
# updates direct dependencies only
pnpm --recursive update --depth 0
# update typescript to the latest version in every package
pnpm --recursive update typescript@latest
--depth <number>#
- Default: Infinity
- 유형: Number
How deep in the dependency tree to update. 0 updates direct dependencies only.
--latest, -L#
package.json에 지정된 버전 범위가 latest 태그보다 낮은 한, 종속성을 latest 태그로 결정되는 최신 안정 버전으로 업데이트합니다 (메이저 버전을 넘어 업그레이드될 수 있음) (즉, 프리릴리스를 다운그레이드하지는 않습니다).
Since v12.6.0, --latest does not move a dependency past a specifier supplied by packageExtensions, a readPackage hook, or an override. The lockfile stays inside that specifier.
Since v12.23.0, pnpm update --latest <name> moves the override keyed by the bare name of a dependency it selects. The override keeps its range style, so 1.0.0 becomes the new exact version and ^1.0.0 becomes ^<new version>. The package.json entry stays as it is. pnpm update --interactive --latest does the same for the dependencies you select. pnpm prints a warning when it cannot move the override, for example an npm: alias, a $ reference, or a catalog: value. --latest without selectors leaves overrides alone.
A Cargo requirement keeps its operator when updated, so ~1.0 becomes ~1.1
and =1.0.0 stays exact. A requirement with only an upper bound, such as <2,
is kept while the new version matches it, and becomes a caret requirement, such
as ^2.0.0, when --latest moves past it. A requirement in the selector, as in
pnpm update crate:foo@^2, replaces it. savePrefix and saveExact apply only
to new Cargo dependencies. Saved Cargo requirements omit build metadata.
A pinned Rust release keeps its form. 1.95.0 becomes the newest stable
version, 1.95 the newest stable minor line, and nightly-2026-01-01 the
newest nightly. A channel that moves by itself, such as stable, stays as it is.
A Python requirement keeps its operator and precision too, so ~=1.0 becomes
~=2.0 and ==1.* becomes ==2.*. A requirement with only an upper bound,
such as <2, or with several clauses, such as >=1.0,<2, becomes >=2.0 when
--latest moves past it. A selected pre-release that the requirement does not
name, such as 1.4rc1 for ==1.*, adds a clause that names it, as in
==1.*,>=1.4rc1. savePrefix and saveExact do not apply to Python
requirements.
--tag <tag>#
Added in: v12.23.0
Update the dependencies to the version behind the given dist-tag, and write
that version to package.json with the range operator the dependency already
declares. The tag's version is used even when it is lower than the installed
version. pnpm up --tag next foo does the same as pnpm up foo@next.
A dependency that tracks a dist-tag, such as "foo": "latest", is switched to
the given tag. A dependency declared through the catalog:, workspace:, or
npm: protocol, through a named registry, or as a path or git URL, is not
rewritten. Config dependencies are not updated. A package that does not publish
the tag fails the update.
With --global, a package that does not publish the tag keeps its range, and
the other packages are updated. A global package also keeps its installed
version when the tag's version is lower.
The value must be a dist-tag name. A version or a range, such as 1.2.3 or
*, is rejected (ERR_PNPM_UPDATE_INVALID_TAG). --tag cannot be combined
with --latest, --workspace, --patches, or a selector that names a
version, such as foo@2 (ERR_PNPM_TAG_WITH_SPEC).
--patches#
Added in: v12.0.0
Refresh registry revisions without changing any
package version: for every locked registry package, pnpm resolves current
metadata for the same name@version, and adopts the artifact the registry
selects now if that changed. Versions and declared ranges are left alone, but the
lockfile entry is rewritten as a whole (integrity, revision, and the package
snapshot around them), since revisions may declare different dependencies.
Cannot be combined with package selectors, --latest, --tag, --interactive,
or --global (ERR_PNPM_PATCHES_WITH_SELECTOR).
--pnpr-server <url>#
Added in: v12.0.0
Offload the resolution of a --patches refresh to a pnpr server, the
way pnprServer does for an install.
--global, -g#
글로벌 패키지를 업데이트합니다. Packages from the pnpm 10 global layout are migrated to the current layout. After a successful migration, pnpm removes the old installation and its symlinks, shims, and hard-linked executables from PNPM_HOME.
--workspace#
워크스페이스에서 모든 패키지를 연결하려고 시도합니다. 워크스페이스 내 패키지의 버전과 일치하도록 버전이 업데이트됩니다.
특정 패키지가 업데이트된 경우 업데이트된
의존성이 워크스페이스 내에서 발견되지 않으면 명령이 실패합니다. 예를 들어, express가 워크스페이스 패키지가 아니면 다음 명령은 실패합니다:
pnpm up -r --workspace express
--prod, -P, --production#
dependencies 및 optionalDependencies의 패키지만 업데이트합니다.
--dev, -D#
devDependencies의 패키지만 업데이트합니다.
--no-optional#
optionalDependencies의 패키지는 업데이트하지 않습니다.
--optional#
Only update packages in optionalDependencies.
--peer#
Also update packages in peerDependencies. It cannot be combined with --interactive (ERR_PNPM_INTERACTIVE_PEER_UNSUPPORTED).
--save-exact, -E#
With --latest or --tag, write the resolved version to package.json without a range operator. A dependency that already declares a ^, ~, or exact range keeps that operator.
--lockfile-only#
Update pnpm-lock.yaml without downloading dependencies or changing node_modules.
--lockfile-dir <dir>#
The directory in which pnpm-lock.yaml is created. It cannot be combined with --global.
--interactive, -i#
오래된 의존성을 표시하고 업데이트할 의존성을 선택합니다.
For a package from a registry declared with serverType: pnpr, the release notes between the installed and the offered version are shown below the list while the package is under the cursor.
With trustPolicy: no-downgrade, the list of dependencies offers only versions the trust policy accepts, and it has a Trust column. The --global list of package groups has no such column. The column names the strongest trust evidence of the offered version: staged publish, trusted publisher, provenance, or none. If a package in trustPolicyExclude is offered a version with weaker evidence than the installed one, the cell is yellow and also names the installed version's evidence.
Combined with --global, each isolated install group is presented as one selectable item: packages that share a global installation update together as a unit.
--long#
Show package homepage or repository URLs in the interactive update list:
pnpm update --interactive --long
The URL column is hidden by default. This option fetches full package metadata
and only affects --interactive. It cannot be combined with --global, which
selects package groups.
--no-save#
package.json의 범위는 업데이트하지 않습니다.
--changeset#
After the update completes, write a change intent (a changesets-compatible .changeset/*.md file) for affected workspace packages. Changes to dependencies or optionalDependencies get a patch bump, and changes to peerDependencies get a major bump. catalog: 프로토콜을 통해 업데이트된 카탈로그 항목을 사용하는 패키지도 포함됩니다. Private packages, packages without a name or a valid semver version, and packages listed in versioning.ignore or in the ignore array of .changeset/config.json are skipped. If neither the .changeset directory nor versioning in pnpm-workspace.yaml exists, a warning is printed and no changeset is generated.
Set update.changeset to true in pnpm-workspace.yaml to enable this behavior by default.
--no-changeset#
Don't write a change intent, even when update.changeset is true.
--include-github-actions#
저장소의 워크플로 파일에서 참조하는 GitHub Actions도 업데이트합니다. GitHub Actions 업데이트를 참고하세요.
Supply-chain policy flags#
Added in: v12.3.0
pnpm update accepts the same policy overrides as pnpm install and pnpm add: --trust-lockfile, --no-trust-lockfile, --trust-policy, --trust-policy-exclude, and --trust-policy-ignore-after, so a policy can be relaxed or tightened for a single run without editing pnpm-workspace.yaml.
--minimum-release-age <minutes>, --minimum-release-age-exclude <package-spec>#
Added in: v12.23.0
Set minimumReleaseAge and minimumReleaseAgeExclude for this run, as they do for pnpm install.
--cpu, --os, --libc, --ignore-scripts, --ignore-pnpmfile#
These work as they do for pnpm install.