Next.js Discord

Discord Forum

deploying prisma to vercel, Error: @prisma/client did not initialize yet. Please run "prisma generat

Unanswered
>>>>> posted this in #help-forum
Open in Discord

141 Replies

Are you sure that the commit its deploying has the postinstall in the package.json
and that its not an older commit
let me show u my package json
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"postinstall": "prisma generate"
},
"dependencies": {
"@clerk/nextjs": "^4.29.1",
"@prisma/client": "^5.7.1",
"@vercel/postgres": "^0.5.1",
"next": "14.0.4",
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.49.2",
"react-icons": "^4.12.0",
"react-input-mask": "^2.0.4",
"react-intersection-observer": "^9.5.3",
"react-modal": "^3.16.1",
"sweetalert2": "^11.10.2"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react-modal": "^3.16.3",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
"postcss": "^8",
"prisma": "^5.7.1",
"tailwindcss": "^3.3.0",
"tailwindcss-animated": "^1.0.1",
"typescript": "^5"
}
}
cuz if u followed this tbh im just grasping at straws here
everything in that documitation
If you see prisma: command not found errors during your deployment to Vercel, you are missing prisma in your dependencies. By default, prisma is a dev dependency and may need to be moved to be a standard dependency.
i have it
try moving prisma to dependencies
its in devDependencies
ohh i didnt see that
👀
wait can you provide me link for where to find dev dependencies
in ur package.json
{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "postinstall": "prisma generate"
  },
  "dependencies": {
    "@clerk/nextjs": "^4.29.1",
    "@prisma/client": "^5.7.1",
    "@vercel/postgres": "^0.5.1",
    "next": "14.0.4",
    "react": "^18",
    "react-dom": "^18",
    "react-hook-form": "^7.49.2",
    "react-icons": "^4.12.0",
    "react-input-mask": "^2.0.4",
    "react-intersection-observer": "^9.5.3",
    "react-modal": "^3.16.1",
    "sweetalert2": "^11.10.2"
                          // <====== MOVE PRISMA HERE
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "@types/react-modal": "^3.16.3",
    "autoprefixer": "^10.0.1",
    "eslint": "^8",
    "eslint-config-next": "14.0.4",
    "postcss": "^8",
    "prisma": "^5.7.1", //<========== TAKE PRISMA OUT
    "tailwindcss": "^3.3.0",
    "tailwindcss-animated": "^1.0.1",
    "typescript": "^5"
  }
}
make a new commit and then do oa new dpeloyment
okay ill try that
devDependencies are basically all the stuff u need in the project that you dont import in ur files( import x from 'y' )
those go in dependencies i.e. react, @prisma/client, etc....
that might help actually because i found some styling dont apply after building
yeah you wanna make sure u dont just put everything in dependencies b/c then youll overload the client with packages they dont need xD
you have experience with prisma and nextjs ?
@cougarb8
im doing it rn actually
no need to change something here right ?
i dont think so
@cougarb8 im doing it rn actually
if the deploy work fine i had issue before i was going to look into after deploying
tell me ab it
well if it did work
hmmm
i might go crazy with this error
this might be lowkey a longshot
but
what if
you generated before build
ill try that
//package.json
{
  "scripts":{
    "build": "npx prisma db push && npx prisma generate && next build"
  }
}
ill try what prima ai prisma gave me and ill try urs
i got same error but at first in my building i can see prisma generate
its the same error but it said client ready to use?
try putting npx in front of prisma
actually if u moved prisma to dependencies it wont matter
but still same error
so remove the package-lock?
damn thats hacky af lmao
rm -f package-lock.json
wait no dont do that
dud that documentation is 3 years old
delete that
well the only documation i can find
also was prisma ai who did proved it
oh
u do override the build command
i guess as the "other way"
😂
hopefully it works
i hope so ill try haha
"scripts": {
"dev": "next dev",
"build": "prisma generate && next build",
"start": "next start",
"lint": "next lint",
"postinstall": "prisma generate"
},
bro put the npx
it cant hurt
leaking ur env variables
im gonna steal them
jk jk
haha
lgtm
looks good to me
well for vercel dont look good or him
generating prisma client 3 times 😂 hopefully one will work
actually twice i think
😂
if u do that prob remove it from ur package.json
if it works
🙏
have u done a lot of next before
haha
@cougarb8 have u done a lot of next before
not a lot
4 months
make a separate branch next time and deploy from that branch while ur developing
nice nice
wby ?
i did some react at my last 2 internships and just been messing with it for a couple months
same actually
next is so good when it works
but yeh its buggy asf
yeah but this error gonna get me crazy
im not doing server actions in my app
ill remove package-lock i guess
no dont do that
@cougarb8 im not doing server actions in my app
the place where i work still using page router
include it in the instal script
@>>>>> the place where i work still using page router
damnn u guys use next? lucky asf
where iworked they used create react app 💀
i was migrating class components
damn haha
i need to find a job wher i can use next that'd be amazing
are u guys hirign
i should get prisma in dependencies too here ?
yes that should be in dependencies
they are hiring but i dont think they hired ppl full remote
what about interns
im a student
im interns
they did give me 2 days remote after 4months with them while ppl who work get it after 2 months
they let uwork remote for only 2 days?
my company had a mandate last summer so we had to do 3 days in office
and mon/fri were WFH
do u guys use prisma there too?
what company is it
yeah
called harmony thechnologie
damn nice
what do u think of that tech stack
ill try one more thing is calling my co worker who is backend that use prima
and he did deploy a project recently
if he cant find me the issue im paying someone in fiver
😭
dead asf bro
i did everything that in doc but still thet issue getting me crazy
did u try removing package lock at install time
in the build settings
rm package-lock.json && npm install
no
ill try
🙏
didnt work either
f
if it was my project i was gona give up but its a client project that should be deploying
😂 fck
i been in one of those freelancing situations
never again frfr
😂 yeah well i had to
i cant be spending full weel working on it and in the end dont work because of that error
dud lmk what the soln is cuz im prolly gonna have this problem
yeah i will thanks for your time