Can't deploy my turborepo. (Could not resolve prisma client)

I cant deploy my turbo repo on vercel, my file client.ts in my DB package can’t find the generated prisma files during my turbo build.
It works locally, but on vercel i get an error.

//client.ts
import { withAccelerate } from "@prisma/extension-accelerate";
import { PrismaClient } from "./generated/prisma/client";

const globalForPrisma = global as unknown as { prisma: PrismaClient };

export const prisma =
	globalForPrisma.prisma || new PrismaClient().$extends(withAccelerate());

if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;

//schema.prism
generator client {
  provider = "prisma-client"
  output   = "../../src/generated/prisma"
  moduleFormat = "esm"
  runtime = "nodejs"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

//turbo.json
{
	"$schema": "https://turbo.build/schema.json",
	"ui": "tui",
	"tasks": {
		"build": {
			"dependsOn": ["^db:generate", "^build"],
			"inputs": ["$TURBO_DEFAULT$", ".env*"],
			"outputs": ["dist/**"],
			"env": ["DATABASE_URL"]
		},
		"lint": {
			"dependsOn": ["^lint"]
		},
		"check-types": {
			"dependsOn": ["^check-types"]
		},
		"dev": {
			"dependsOn": ["^db:generate"],
			"cache": false,
			"persistent": true
		},
		"db:push": {
			"cache": false
		},
		"db:studio": {
			"cache": false,
			"persistent": true
		},
		"db:migrate": {
			"cache": false,
			"persistent": true
		},
		"db:generate": {
			"cache": false,
			"outputs": ["src/generated/**"]
		}
	}
}

did you find a fix? i have the same problem

i also need help on this

This might be a bit outdated now, but I wanted to share what worked for me. I was deploying a Turborepo monorepo to Vercel with these versions:

{
  "next": "^16.1.1",
  "react": "^19.2.3",
  "prisma": "^6.19.0",
  "@prisma/client": "^6.19.0"
}

Monorepo structure (example)

My repo looked roughly like this (two Next.js apps):

apps/
  web/      # Next.js app (main)
    package.json
  docs/     # Next.js app (docs)
    package.json
packages/
  db/       # Prisma package (schema + generated client)
    prisma/
      schema.prisma
    generated/
      client/
turbo.json
pnpm-workspace.yaml

Both apps/web and apps/docs import Prisma via the shared packages/db.

What was happning

In a monorepo setup (apps/ + packages/), Prisma Client (and the Query Engine .so.node) is often generated inside a shared package (e.g. packages/db/...). With Next.js 16, builds default to Turbopack, and I found that in this mode the Prisma workaround that relies on Webpack hooks didn’t reliably run / copy the engine into the server output. This resulted in either:

  • build-time “could not resolve Prisma Client”, or
  • runtime “Prisma Client could not locate the Query Engine (rhel-openssl-3.0.x)” on Vercel

Fix (the 3 things that finally made it stable)

1) Force Next build to use Webpack

This was the most important piece for me:

// apps/<your-next-app>/package.json
{
  "scripts": {
    "build": "next build --webpack"
  }
}

2) Add Prisma’s monorepo workaround plugin to next.config

// apps/<your-next-app>/next.config.mjs
import { PrismaPlugin } from "@prisma/nextjs-monorepo-workaround-plugin";

const nextConfig = {
  webpack: (config, { isServer }) => {
    if (isServer) config.plugins.push(new PrismaPlugin());
    return config;
  },
};

export default nextConfig;

3) (Extra safety) Specify binaryTargets in schema.prisma

// packages/<db-package>/prisma/schema.prisma
generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-3.0.x"]
}