Skip to content
Latchkey

pnpm update: Usage, Options & Common Errors

Upgrade dependencies and update pnpm-lock.yaml.

pnpm update (alias pnpm up) raises dependencies to newer versions and rewrites pnpm-lock.yaml, with flags for latest versions and workspace-wide updates.

What it does

Updates packages to the newest version allowed by their package.json ranges; --latest ignores ranges and goes to the newest published (updating package.json). -r updates across all workspaces, and -i runs an interactive picker.

Common usage

Terminal
pnpm update                 # in-range updates
pnpm update --latest        # jump to latest, update package.json
pnpm up -r typescript       # update across all workspaces
pnpm update -i              # interactive

Common CI gotcha: update rewrites the lockfile

Running pnpm update in CI changes pnpm-lock.yaml and then breaks the next --frozen-lockfile install. Do updates locally, commit the new lockfile, and keep CI on pnpm install --frozen-lockfile.

Terminal
# locally:
pnpm update && git add pnpm-lock.yaml && git commit -m "deps"

Using this in CI

Node tooling on a runner differs from your machine in three ways that matter: CI=true is set, there is no TTY, and the Node major may not be the one you develop on.

  • Pin the Node major with setup-node and in engines. Native modules resolve different prebuilt binaries per major.
  • CI=true changes behaviour in several tools, most often by promoting warnings to errors or disabling interactive prompts.
  • Commands that expect a TTY will hang. Pass the non-interactive or --yes flag explicitly.
  • Use npm exec or node_modules/.bin rather than assuming a globally installed binary is on PATH.

Frequently asked questions

pnpm update: Usage, Options & Common Errors?
pnpm update (alias pnpm up) raises dependencies to newer versions and rewrites pnpm-lock.yaml, with flags for latest versions and workspace-wide updates.
What it does?
Updates packages to the newest version allowed by their package.json ranges; --latest ignores ranges and goes to the newest published (updating package.json). -r updates across all workspaces, and -i runs an interactive picker.
Common CI gotcha: update rewrites the lockfile?
Running pnpm update in CI changes pnpm-lock.yaml and then breaks the next --frozen-lockfile install. Do updates locally, commit the new lockfile, and keep CI on pnpm install --frozen-lockfile.

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card