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"
}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.
Related errors
- TypeError: Cannot read properties of undefined
- CORS error: blocked by CORS policy
- Hydration failed: server HTML didn't match the client (Next.js)
- Module not found: Can't resolve '...'
Weekly: the errors breaking vibe-coded apps and how to fix them. Free.
No spam. Unsubscribe anytime.