- Published on
How to fix "@prisma/client did not initialize yet" in Vercel
- Authors
- Name
- Ashik Nesin
- @AshikNesin
If you've manually set up Prisma then chances are you might have missed configuring prebuild
for Prisma which might cause issues during build in environments like Vercel.
The fix is straightforward,
Just add npx prisma generate
as prebuild
in your root package.json script.
{
"scripts":{
"build":"next build",
"prebuild":"npx prisma generate"
}
}
We can also add it postinstall
as well which will run prisma generate command right after the npm install
{
"scripts":{
"postinstall":"npx prisma generate"
}
}
pre*
or post*
npm command does?
What does it It basically, runs our command before/after the particular npm command.
Happy fixing Prisma!