#"PrismaClient" is not exported by "generated/client",

3 messages · Page 1 of 1 (latest)

rugged pathBOT
#

You've gone full bot mode! Let me fetch that AI answer for you ASAP.

rugged pathBOT
# rugged path You've gone full bot mode! Let me fetch that AI answer for you ASAP.

This usually happens when:

  1. You use a custom output for the client, and
  2. You still import from @prisma/client or from a path that doesn’t match what Prisma actually generates.

With a custom output like:

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

Prisma will generate a module at src/generated/client that you must import from directly, e.g.:

// packages/database/src/client.ts
import { PrismaClient } from '../generated/client';

const prisma = new PrismaClient();
export { prisma };

This is the same pattern used in Prisma’s Turborepo guide, where the client is generated to ../generated/prisma and then imported from that path instead of @prisma/client.[Turborepo guide]

Also, since Prisma 6.6+ you must align your imports with the custom output path; if you keep importing from the old location, TypeScript (or your bundler) will correctly say PrismaClient is not exported.[Issue 13672 comment]

If you still see the error:

  1. Run npx prisma generate in the database package.
  2. Confirm that src/generated/client/index.d.ts (and .js) actually export PrismaClient.
  3. Make sure your import path in client.ts is exactly the relative path to that generated folder.
rugged pathBOT