ERROR Nuxt Build Error: [commonjs--resolver] Invalid module ".prisma/client/index-browser"
Hi i'm using Nuxt 4 + Prisma and i'm trying to build it but there's an error on it.
Here's th version:
"@prisma/client": "^6.14.0",
"@prisma/nuxt": "^0.3.0",
5 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
This error is a known issue when using Nuxt (including Nuxt 3 and 4) with Prisma, especially with recent versions of both. The error:
occurs because the build process cannot resolve the
Add a Vite alias in your
.prisma/client/index-browser
module specifier. This is typically due to how Vite (used by Nuxt) handles module resolution for Prisma's generated client.
Solution:Add a Vite alias in your
nuxt.config.ts
to explicitly map .prisma/client/index-browser
to the correct file:
This workaround is recommended in the official Prisma documentation and has been confirmed by multiple users to resolve the build error in both development and production environments. If you are using pnpm and encounter issues, ensure you have a .npmrc
file with hoist-pattern[]=*prisma*
to hoist dependencies properly. Also, avoid customizing the Prisma Client output directory, as @prisma/nuxt
expects the client in its default location within node_modules
<sup>Prisma Nuxt Module Troubleshooting</sup>.
If you still encounter issues, double-check that you do not have any custom output set in your schema.prisma
generator block, and that you have run npx prisma generate
after any changes.
Let me know if you need more help!Did the bot recommendation help?
✅ Great, thanks for letting us know that this solved your question!
Yes the build is successful
Glad to hear that!