deploying prisma to vercel, Error: @prisma/client did not initialize yet. Please run "prisma generat
Unanswered
>>>>> posted this in #help-forum
>>>>>OP
141 Replies
Are you sure that the commit its deploying has the postinstall in the package.json
and that its not an older commit
>>>>>OP
let me show u my package json
>>>>>OP
{
"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"
}
}
"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
>>>>>OP
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.
>>>>>OP
i have it
try moving prisma to dependencies
its in devDependencies
>>>>>OP
ohh i didnt see that
👀
>>>>>OP
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
>>>>>OP
okay ill try that
devDependencies are basically all the stuff u need in the project that you dont import in ur files(
those go in dependencies i.e. react, @prisma/client, etc....
import x from 'y' )those go in dependencies i.e. react, @prisma/client, etc....
>>>>>OP
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
>>>>>OP
you have experience with prisma and nextjs ?
@cougarb8
im doing it rn actually
>>>>>OP
no need to change something here right ?
i dont think so
@cougarb8 im doing it rn actually
>>>>>OP
if the deploy work fine i had issue before i was going to look into after deploying
tell me ab it
hmmm
>>>>>OP
i might go crazy with this error
//package.json
{
"scripts":{
"build": "npx prisma db push && npx prisma generate && next build"
}
}>>>>>OP
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
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
>>>>>OP
well the only documation i can find
also was prisma ai who did proved it
>>>>>OP
i hope so ill try haha
>>>>>OP
"scripts": {
"dev": "next dev",
"build": "prisma generate && next build",
"start": "next start",
"lint": "next lint",
"postinstall": "prisma generate"
},
"dev": "next dev",
"build": "prisma generate && next build",
"start": "next start",
"lint": "next lint",
"postinstall": "prisma generate"
},
bro put the npx
it cant hurt
>>>>>OP
>>>>>OP
haha
lgtm
looks good to me
>>>>>OP
well for vercel dont look good or him
generating prisma client 3 times 😂 hopefully one will work
actually twice i think
>>>>>OP
😂
if u do that prob remove it from ur package.json
if it works
ðŸ™
have u done a lot of next before
>>>>>OP
haha
@cougarb8 have u done a lot of next before
>>>>>OP
not a lot
4 months
make a separate branch next time and deploy from that branch while ur developing
nice nice
>>>>>OP
wby ?
i did some react at my last 2 internships and just been messing with it for a couple months
>>>>>OP
same actually
next is so good when it works
but yeh its buggy asf
>>>>>OP
yeah but this error gonna get me crazy
im not doing server actions in my app
>>>>>OP
ill remove package-lock i guess
no dont do that
@cougarb8 im not doing server actions in my app
>>>>>OP
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
>>>>>OP
damn haha
i need to find a job wher i can use next that'd be amazing
are u guys hirign
>>>>>OP
i should get prisma in dependencies too here ?
yes that should be in dependencies
>>>>>OP
they are hiring but i dont think they hired ppl full remote
what about interns
im a student
>>>>>OP
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
>>>>>OP
yeah
called harmony thechnologie
damn nice
what do u think of that tech stack
>>>>>OP
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
>>>>>OP
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>>>>>OP
no
ill try
ðŸ™
>>>>>OP
didnt work either
>>>>>OP
if it was my project i was gona give up but its a client project that should be deploying
>>>>>OP
😂 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
>>>>>OP
yeah i will thanks for your time