Title
i

Ivan Lukianchuk

02/12/2021, 2:44 AM
I tried pushing my nextJs site to vercel and it failed with some error saying: Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again. Is this not somehow done automatically, or how to do I make vercel do it? it also said check out this url, which wasn't too helpful: https://github.com/prisma/prisma-client-js/issues/390
r

Ryan

02/12/2021, 7:55 AM
@Ivan Lukianchuk 👋 I think you’re facing a similar issue as mentioned here so the solution might be to run
prisma generate
in a postinstall hook.
i

Ivan Lukianchuk

02/12/2021, 1:58 PM
I'm still not sure exactly what to do. I've followed the links and other links and it kind of talks about postinstall but no one will just write out the 1 to 3 lines we need to use. I tried adding this: "postinstall": "npm run prisma generate" so my scripts looks like this: "scripts": {     "dev": "next dev",     "build": "next build",     "start": "next start",     "postinstall": "npm run prisma generate"   }, and I get the error: npm ERR! missing script: prisma If I add these 3 lines from someone's linked code: "generate": "npm -s run generate:prisma",     "generate😛risma": "prisma generate",     "postinstall": "npm run generate" I get this: sh: prisma: command not found I'm not a package.json expert, I usually can build things without touching it, so I'm not sure of the lifecycle or intricacies of all these build scripts, so I'm really hoping there is a simple answer here I'm just missing
the only reason I got prisma was for nextJs, and every doc I or tutorial seem to follow is broken or using something outdated, so it continues to be a frustrating journey 😕
r

Ryan

02/12/2021, 1:59 PM
"postinstall": "npx prisma generate"
This is all that’s required.
i

Ivan Lukianchuk

02/12/2021, 2:00 PM
ok, let me give that a try
r

Ryan

02/12/2021, 2:01 PM
the only reason I got prisma was for nextJs, and every doc I or tutorial seem to follow is broken or using something outdated,
Have you followed this from the docs? It seems to work fine for me.
i

Ivan Lukianchuk

02/12/2021, 2:26 PM
ok, that line seemed to do it
👍 1
I didn't follow that specific tutorial, I created a new project a few weeks ago and then added prisma to it, following the other docs for adding to existing I believe
I'm not sure if inbetween that time you changed to add prisma versus I think it used to be add prisma/cli
feels like some major changes were happening fast since I started working and playing with Prisma
r

Ryan

02/12/2021, 2:29 PM
Vercel caches
node_modules
which is why you were facing this issue.
I’m not sure if inbetween that time you changed to add prisma versus I think it used to be add prisma/cli
That shouldn’t affect the workflow as
npx prisma
would work in either way.
i

Ivan Lukianchuk

02/12/2021, 2:31 PM
hmm, well I only just pushed to a fresh vercel yesterday, so I assume it would have to add all the node modules right there, and it failed on first try, but I didn't have the postinstall hook, although is that always needed, because I never saw it in any docs
r

Ryan

02/12/2021, 2:34 PM
This was a recently faced issue with Vercel as a couple of other users were facing this as well.
i

Ivan Lukianchuk

02/12/2021, 2:37 PM
well it would definitely be worth popping this line somewhere in the docs for future folk, or even in the error messages generated, like the one that told me to go to issue 390 I saw in the vercel logs
I find the problem with linking to those issues is they never just give you the straight fix for the general case, which I know isn't the purpose at the time, but unlike stack overflow, they are really hard to parse and get the true answer you need
I do appreciate the quick responses and help on this slack though, saved me from more hair pulling this early in the morning 🙂 Thanks
🙌 1
r

Ryan

02/12/2021, 2:40 PM
Yeah this will be added to the docs in the deployment guide 🙂