Vercel auto-upgrading dependencies causing build errors

I’ve been stuck for over 24 hours trying to fix a build error on my Vercel-hosted project, and nothing works.

The site was working perfectly on an older version, but even if I make very small changes (like editing the footer text or a button), the deploy fails with the same error.

The issue started because Vercel is automatically updating some dependencies, especially:

•	It upgrades @ai-sdk/openai to 2.x and ai to 5.x.

•	These versions use zod@3, but during the build, a zod@4 version is also installed, which doesn’t export ./v4 as expected.

•	This results in multiple Module not found: Package path ./v4 is not exported from package zod errors during the build.

What I’ve tried so far (unsuccessful):

•	Pinning exact versions in package.json (Vercel still upgrades them automatically).

•	git pull and merge conflict resolution.

•	Clearing and reinstalling dependencies locally (rm -rf node_modules && pnpm install).

•	Forcing an older pnpm version with corepack.

•	Manually adjusting files to compatible versions.

Nothing fixes it.

Vercel keeps upgrading the packages, and the error keeps coming back — even for the smallest front-end changes.

Question:

How can I force Vercel to use exactly the dependency versions I have locally, so the build works as before without automatic upgrades breaking compatibility?

Hey, @estracaofficial-2066!

If you commit your lockfile (pnpm-lock.yaml, package-lock.json, or yarn.lock) to your repository, Vercel should respect the exact versions specified in the lockfile.

Let us know how you get on!

Also in case this is helpful to you or anyone that comes across similar build errors!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.