Module '"@prisma/client"' has no exported member 'PrismaClient'

Module '"@prisma/client"' has no exported member 'PrismaClient'

This issue arises when I created my own db file:

import { PrismaClient } from '@prisma/client'

export const db = new PrismaClient();

I am using NextJS Prisma.

Answer

Go to your prisma folder and check your schema.prisma file. The generator client should give you an idea where you should look for the client:

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

I was import the client from '@prisma/client' but as you can see from the output above. The import should be from "../generated/prisma" or '@/generated/prisma/client', depending on your coding style.

Enjoyed this article?

Check out more content on our blog or follow us on social media.

Browse more articles