#Updated to prisma v7 and now getting errors

7 messages · Page 1 of 1 (latest)

untold fiber
#

I updated to the v7 and I'm getting these errors:

[vite] Error when evaluating SSR module /app/service/db.server.ts: failed to import "@prisma/client"
|- Error: Cannot find module '/Users/xyz/Project/node_modules/@prisma/client/runtime/library.js'
vale swallowBOT
#

You opted for speed from this bot. Let's conjure up an answer right now!

vale swallowBOT
# vale swallow You opted for speed from this bot. Let's conjure up an answer right now!

This error usually means your generated Prisma Client doesn’t match what @prisma/client v7 expects (path runtime/library.js no longer exists or isn’t exported).

From similar reports, there are two common fixes you can try:

  1. Regenerate the client to a dedicated output folder and import from there

In your schema.prisma:

generator client {
  provider = "prisma-client-js"
  output   = "../node_modules/.prisma/client"
}

Then:

pnpm prisma generate   # or npm/yarn equivalent

And update your imports:

import { PrismaClient } from '../node_modules/.prisma/client';

This pattern resolved runtime/library.js / ultron path errors for others after upgrading. [runtime subpath fix; ultron error]

  1. Ensure both packages are on v7 and fully reinstalled

Upgrade and reinstall cleanly:

# with pnpm
pnpm upgrade prisma@7 @prisma/client@7
rm -rf node_modules .pnpm-lock.yaml
pnpm install
pnpm prisma generate

The docs explicitly say you must upgrade both prisma and @prisma/client to v7 together. [Upgrade to v7]

If you still see Vite SSR resolution issues after that, they’re likely build‑tool related (similar to earlier Vite/Prisma interop problems), but the knowledge I have only documents the runtime/library.js path fixes above, not a Vite‑specific v7 change.

vale swallowBOT
granite rampart
#

How are you importing the PrismaClient?

Can you share the prisma.config.ts file and the generator block of your schema.prisma file?

untold fiber
#

I don't even have prisma.config.ts file

In schema.prisma

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

And is there any optimization for Mongodb in the latest version?

#

I'm using vite, so I've vite.config.ts file, and there is nothing inside this file which is related to prisma. 🤔