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
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 # interactiveCommon 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.
# 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-nodeand inengines. Native modules resolve different prebuilt binaries per major. CI=truechanges 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
--yesflag explicitly. - Use
npm execornode_modules/.binrather than assuming a globally installed binary is on PATH.