Error: @prisma/client did not initialize yet.
Hello everybody!
I'm working on a small nextjs project and ran into this error, after entering my info and going to my dashboard page:
Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
export const client = globalThis.prisma || new PrismaClient()
I've tried running the command again, deleting node modules and installing everything again to no avail. Can anybody help out?
I'm working on a small nextjs project and ran into this error, after entering my info and going to my dashboard page:
Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
export const client = globalThis.prisma || new PrismaClient()
I've tried running the command again, deleting node modules and installing everything again to no avail. Can anybody help out?
Solution
I had a similar issue, and I think I solved it by setting up a separate Prisma client file that looks like this
Then I just
Then I just
import prisma from @/lib/prisma.ts wherever I want to use the client.