I am using pnpm [email protected] and Prisma 6.19.0 for a backend application. When I add the Prisma service, I get the error
Nest] 46276 - 17/11/2025, 12:45:49 ERROR [ExceptionHandler] Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
I have run pnpx prisma generate. This returns Generated Prisma Client (6.19.0) to ./generated/prisma
Based on the NestJs site, I have updated tsconfig.build.json to have the entry:
"include": ["src", "generated"],
In schema.prisma I have:
generator client {
provider = "prisma-client"
output = "../generated/prisma"
}
In the prisma.service.ts I have:
import { Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}
}
If it would help, I can add the project to GitHub.
I am unclear how to correct the error