Vercel Build Dependency Caching Workaround | Vercel Cache Prisma Error

Stumbled across this error? 👇

Prisma has detected that this project was built on Vercel, which caches dependencies.
This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered.
To fix this, make sure to run the `prisma generate` command during the build process.

Learn how: https://pris.ly/d/vercel-build

Update your package.json

It can be fixed by overriding the build script in your package.json.

{
  ...
  "scripts" {
    "build": "prisma generate && <actual-build-command>"
  }
  ...
}

Override your build settings in Vercel

You can also update it straight from the Vercel UI.

Go to your project settings and override the build settings to run prisma generate && <actual-build-command> or if it's a Next.js project here's the full example:

npx prisma generate && next build

Screenshot of the build override settings


Follow me on Twitter or connect on LinkedIn.

🚨 Want to make friends and learn from peers? You can join our free web developer community here. 🎉

FixNextjsPrismaVercel
Avatar for Niall Maher

Written by Niall Maher

Founder of Codú - The web developer community! I've worked in nearly every corner of technology businesses; Lead Developer, Software Architect, Product Manager, CTO and now happily a Founder.

Loading

Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.