P
Prisma•3mo ago
Noor Fakhry

NextJS PrismaPostgress Underlying Error:Error: {"message":"Unexpected Server Error"}

hey everyone, i am setting up a nextjs project with prisma postgress but when i type this command npx prisma init --db --output ../app/generated/prisma i get this error
No description
4 Replies
Prisma AI Help
Prisma AI Help•3mo ago
Skipping coffee for instant knowledge! Let's brew that AI answer now. The error you're seeing when running:
npx prisma init --db --output ../app/generated/prisma
npx prisma init --db --output ../app/generated/prisma
is a known issue affecting recent Prisma versions (6.8.x and 6.9.x), especially with package managers like npm and pnpm. The error often looks like:
Error: Cannot find module '@prisma/cli-init'...
Error: Cannot find module '@prisma/cli-init'...
or a generic "Unexpected Server Error" during the init process. Workarounds and Solutions: 1. Downgrade Prisma:
Many users have resolved this by downgrading Prisma to version 6.7.0, which does not have this bug. Run:
npm install prisma@6.7.0 @prisma/client@6.7.0
npm install prisma@6.7.0 @prisma/client@6.7.0
Then try your npx prisma init ... command again.
See related issues, another report, user confirmations. 2. Clear Cache:
If you previously tried with a broken version, clear your npm/pnpm cache and delete any temporary Prisma folders. For example, on Mac:
rm -rf /var/folders/*/*/*/T/@prisma
rm -rf /var/folders/*/*/*/T/@prisma
On Linux, clear /tmp/@prisma.
Cache clearing advice. 3. Use Latest CLI Explicitly:
If the --db flag is not recognized or you get unexpected errors, try:
npx prisma@latest init --db --output ../app/generated/prisma
npx prisma@latest init --db --output ../app/generated/prisma
This ensures you're using the latest CLI, not a cached or broken one.
See troubleshooting guide. Summary:
This is a regression in recent Prisma versions. Downgrading to 6.7.0 and clearing caches is the most reliable fix right now. Prisma maintainers are aware and working on a permanent solution. If you continue to have issues, please provide your OS, Node, npm/pnpm, and Prisma versions for more targeted help. 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Noor Fakhry
Noor FakhryOP•3mo ago
now i am getting this error ERROR Failed to run subcommand. Underlying Error: FetchError: request to https://console.prisma.io/api failed, reason: read ECONNRESET
Nurul
Nurul•3mo ago
What happens if you run the command: npx prisma@latest init --db --output ../app/generated/prisma
Noor Fakhry
Noor FakhryOP•3mo ago
i tried it and still, i get the same error @Nurul (Prisma)

Did you find this page helpful?