Error "@prisma/client did not initialize yet." in Nuxt 4
So tl;dr of the issue is that when calling any API endpoint that uses Prisma I get following error
My project is using Nuxt 4 with new directory structure and Supabase. Prisma Studio is working normally so in some level the connection between prisma and the database is there.
I have attached screenshot of my directory structure. Anything that looks odd there? I highlighted the prisma related stuff and the API endpoint using it that triggers the error.
I have also attached a screenshot of the API Endpoint where PrismaClient is being imported and used.
Also I should clarify that I have tried to run
That seemed to run successfully, yet the issue persists.
Essentially it seems to me that in the get-for-user-new API endpoint the following line fails
Any help would be appreciated. Hope this is enough information.


4 Replies
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the
#ask-ai
channel awaits if you're curious!Hey!
Are you using custom output path?
Did you had a chance to look at this GitHub Discussion:
https://github.com/prisma/prisma/discussions/23741
GitHub
Error: @prisma/client did not initialize yet. Please run "prisma ge...
Question i have added prisma generate in postinstall section in package.json i am getting this error in vercel. Error: @prisma/client did not initialize yet. Please run "prisma generate" ...
Yes, this fixed it for me.
In my schema.prisma file I had:
I just removed the output completely and now it works. I hadn't seen the issue thread that you showed me before. Somehow didn't come up while I was googling the issue. I had seen this one: https://github.com/prisma/prisma/issues/26991. However I was skeptical it was related to that as everything ran fine for me before the Nuxt 4 Directory structure change.
Not sure if you know about the Nuxt specifically, but here's a bit of stupid question. Now when I ran generate I got following message:
Does this mean that the /generated folder in my project root is now unnecessary? (It only contained the /prisma folder in it.
Once again huge thanks for help! š Sorry it took so long to get back to you. Have had some busy days irl and just now had both time and non sleep deprived brain to get back to this issue.
GitHub
prisma/prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - prisma/prisma
If you have removed the output path then, the /generated folder is unnecessary š