Prisma: @prisma/client did not initialize yet
Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.In one sentence: The Prisma client code hasn't been generated from your schema, so your app has nothing to import.
What it means
Prisma generates a database client tailored to your `schema.prisma`. That generated code is what `@prisma/client` loads. If `prisma generate` never ran (or ran before your latest schema change), the import fails.
This is very common on Vercel, which caches dependencies so the generate step may not run automatically.
Common causes
- `prisma generate` wasn't run after installing or after editing the schema.
- The deploy platform's cached node_modules skipped Prisma's auto-generate step.
- The schema file isn't where Prisma expects it (`prisma/schema.prisma`) and no path is configured.
How to fix it
- Run `npx prisma generate` locally after every schema change.
- Make generation part of the build: add `"postinstall": "prisma generate"` to package.json scripts, or change build to `prisma generate && next build`.
- If the schema changed, also apply it to the database with `npx prisma migrate dev` (local) or `npx prisma migrate deploy` (production).
Example
// package.json
"scripts": {
"postinstall": "prisma generate",
"build": "prisma generate && next build"
}Tried this and it's still broken? Paste your exact error for a free explanation of your specific case.
Prompt to paste into your AI tool
Prisma says the client did not initialize. Add prisma generate to postinstall and the build script, and make sure migrations are applied. Don't change my schema.Still stuck?
Paste your exact error and code. Get a plain-English explanation free, or the full fix for $5.
Hitting errors every day? Builder is $15/mo for 100 fixes per month. Compare plans
Related errors
- Prisma P1001: Can't reach database server
- SyntaxError: Unexpected token '<', "<!DOCTYPE" is not valid JSON
- Objects are not valid as a React child
- Warning: Each child in a list should have a unique "key" prop
Weekly: the errors breaking vibe-coded apps and how to fix them. Free.
No spam. Unsubscribe anytime.