@prisma/client v6.9 issue
I'm still getting this damn error when running build or dev:
Collecting page data .Error: Failed to load external module @prisma/client: Error: Cannot find module '.prisma/client/default'
Require stack:
- C:\Users\dmoza\Documents\projects\my\saas\openstud\node_modules\.pnpm\@prisma+client@6.9.0_prisma_12f395b7f2c46395cb11d4f7d1b6236f\node_modules\@prisma\client\default.js
- C:\Users\dmoza\Documents\projects\my\saas\openstud\.next\server\chunks\[root-of-the-server]__60ad3a87._.js
- C:\Users\dmoza\Documents\projects\my\saas\openstud\.next\server\chunks\[turbopack]_runtime.js
- C:\Users\dmoza\Documents\projects\my\saas\openstud\.next\server\app\api\auth\[...nextauth]\route.js
> Build error occurred
[Error: Failed to collect page data for /api/auth/[...nextauth]] {
type: 'Error'
}
ELIFECYCLE Command failed with exit code 1.
I even modified my schema like this:
generator client {
provider = "prisma-client"
output = "../lib/generated/prisma"
}
generator default {
provider = "prisma-client"
output = "../node_modules/.prisma/client"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}4 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
In my
package.json I have:
"@auth/core": "^0.39.1",
"@auth/prisma-adapter": "^2.9.1",
"@prisma/client": "6.9.0",
"prisma": "6.9.0",You're encountering a common issue with Prisma Client when using pnpm. This error occurs because pnpm has a different node_modules structure than npm, and Prisma is having trouble finding the generated client files.
Based on the knowledge sources, there are several solutions you can try:
1. Add pnpm configuration to approve Prisma's postinstall script:
Add this to your package.json file. This is needed since pnpm v10 doesn't run postinstall scripts by default as mentioned here.
2. Run prisma generate explicitly after installation:
This ensures the client is properly generated regardless of postinstall hooks.
3. Change your output path to be outside of
@prisma/client:
Avoid using paths inside @prisma/client directory as this can cause issues with pnpm as noted here.
4. For your specific schema, try removing the second generator and just keep one with an output path outside of node_modules completely.
The issue appears to be particularly common with pnpm and custom output paths. If these solutions don't work, you might consider temporarily switching to npm until this issue is fully resolved.
Remember to run prisma generate after making these changes to ensure your client is properly generated.
GitHub Issue #25833
GitHub Issue #23538
✅ Great, thanks for letting us know that this solved your question!Glad to see that the bot response was helpful 🙂