@prisma/client did not initialize yet
Last verified:
The fix
@prisma/client did not initialize yet. Run prisma generate so the client matches the schema. Generate does not migrate. Restart after it succeeds.
- 1
Generate the client
From the folder that contains
schema.prisma, run generate. Commit the schema. Do not commitnode_modulesor the generated client if it lives insidenode_modules.npx prisma generate - 2
Generate on every install
Add a postinstall script so Vercel and any clean install build the client. If the host installs with
--ignore-scripts, putprisma generatein the build command beforenext buildinstead.{ "scripts": { "postinstall": "prisma generate", "build": "prisma generate && next build" } } - 3
Point the schema at the right file
If the schema is not at
prisma/schema.prisma, generate needs--schemaor theprisma.schemaentry inpackage.json. A second schema the model created in a subfolder will not be the one the import uses. - 4
Separate generate from migrate
Do not run
prisma migrate devon Vercel. That command is interactive and can reset a database. Useprisma migrate deployin a release step when migrations should ship. A connection error after generate succeeds is the database URL, not this error. See the Postgres page.
Why it happens
@prisma/client is a small package until prisma generate reads schema.prisma and writes the client. A fresh install, a schema edit, or a CI machine that skipped install scripts will import a client that is not there yet.
prisma generate does not talk to the database and does not apply migrations. migrate dev is for your laptop. Production and Vercel should run migrate deploy only when you intend to change the database, and generate has to happen before next build imports the client.
The next error you'll probably hit
Once this is fixed, the usual follow-up is Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x". The Vercel function is looking for the Linux query-engine binary and that file is not in the deployment. Generate ran for another OS, or the binary was stripped from the bundle.
Prompt to paste back into your AI tool
Paste this above the error.
Importing @prisma/client fails with: did not initialize yet. Please run prisma generate. Or: Cannot find module '.prisma/client/default'. Do not mock Prisma. Do not run migrate dev against production. 1. Run prisma generate against the schema this app imports. 2. Add postinstall or a build step so generate runs before next build on a clean install. 3. Leave migrations alone unless I ask. If the next error is a connection failure, stop and say it is the database URL. 4. Do not edit the schema to silence the import.
Common questions
+Generate succeeded and the import still fails. Why?
The running process started before generate, or there are two copies of @prisma/client (a nested node_modules). Restart the dev server. If a custom output path is set in the schema, import that path instead of @prisma/client.
+Does generate apply my migration?
No. It only writes the client. The database changes when you run migrate deploy or migrate dev.
Related errors
- Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x"The Vercel function is looking for the Linux query-engine binary and that file is not in the deployment. Generate ran for another OS, or the binary was stripped from the bundle.CursorBoltReplitPrismaVercelOct 23, 2026
- self-signed certificate in certificate chainself-signed certificate in certificate chain: the Postgres URL is missing TLS. On Vercel, use the pooled URL with sslmode=require. Leave TLS checks on.CursorLovableBoltPostgresPrismaOct 14, 2026
- sorry, too many clients alreadyPostgres or the pooler refused another connection. On Vercel, each warm function was opening its own pool, and the database ran out.Cursorv0BoltPostgresPrismaOct 27, 2026
- Environment variable not found on VercelEnvironment variable not found on Vercel: .env.local stayed on your machine. Add the variable for Production, then redeploy. Do not commit that file.Cursorv0BoltVercelNext.jsOct 14, 2026