--- Upgrading to pnpm 11: A Vercel Migration Guide

Andrew Usher

Upgrading to pnpm 11: A Vercel Migration Guide

1 min read

Upgrading pnpm should be a one-liner. Bump the version in packageManager, run pnpm install, move on. That’s what I thought when I went from 10.13 to 11.3. Locally it was fine. Then Vercel ate the build.

The short version: Vercel doesn’t know about pnpm 11. It picks pnpm 9 instead, which chokes on the new pnpm-workspace.yaml format. The fix is one environment variable in your Vercel dashboard.

What the build log looks like

Detected `pnpm-lock.yaml` 9 which may be generated by pnpm@9.x or pnpm@10.x
Using pnpm@9.x based on project creation date
...
ERROR packages field missing or empty

Vercel’s supported versions table goes up to pnpm 10. Eleven isn’t in it. But it works fine through corepack. You just have to flip the switch.

The fix

Add one environment variable to your Vercel project:

  1. Dashboard → Your project → Settings → Environment Variables
  2. ENABLE_EXPERIMENTAL_COREPACK = 1
  3. Redeploy

With corepack on, Vercel reads packageManager from package.json instead of guessing from the lockfile. Your vercel.json stays clean. No install overrides. No build command hacks.

What you end up with

// package.json
"packageManager": "pnpm@11.3.0"
# pnpm-workspace.yaml
allowBuilds:
  '@sentry/cli': true
  esbuild: true
  msw: true
  sharp: true

And in Vercel: ENABLE_EXPERIMENTAL_COREPACK = 1.

That env var is the whole game. Without it, Vercel doesn’t care what’s in your packageManager field. With it, everything works.

If you liked this article and think others should read it, please share it on Twitter!

Loading views...