Property 'PrismaClientKnownRequestError' does not exist on type 'typeof Prisma'.ts(2339)

I followed this guide https://bun.sh/guides/ecosystem/prisma
{
"name": "myapp",
"module": "src/index.ts",
"type": "module",
"private": true,
"devDependencies": {
"@types/bun": "latest",
"prisma": "^6.7.0"
},
"peerDependencies": {
"typescript": "^5"
},
"dependencies": {
"@prisma/client": "^6.7.0",
"bcryptjs": "^3.0.2"
},
"trustedDependencies": [
"@prisma/client",
"prisma"
]
}
{
"name": "myapp",
"module": "src/index.ts",
"type": "module",
"private": true,
"devDependencies": {
"@types/bun": "latest",
"prisma": "^6.7.0"
},
"peerDependencies": {
"typescript": "^5"
},
"dependencies": {
"@prisma/client": "^6.7.0",
"bcryptjs": "^3.0.2"
},
"trustedDependencies": [
"@prisma/client",
"prisma"
]
}
4 Replies
Prisma AI Help
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the #ask-ai channel awaits if you're curious!
C0casio45
C0casio45OP3w ago
Just to inform, it seems that the type definition of Prisma is not the same between this project and an other project where I used yarn
Arky
Arky3w ago
Seems like it as nothing to do with bun, Prisma changed their types export (don't know since when) but the Prisma namespace exports a lot less than before In order to use the PrismaClientKnownRequestError you now need to import them from "@prisma/client/runtime/library" Example:
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library";

if (myError instanceof PrismaClientKnownRequestError) {
// Do your thing
}
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library";

if (myError instanceof PrismaClientKnownRequestError) {
// Do your thing
}
If anyone knows the version that changed the export I would really like to know which one
C0casio45
C0casio45OP3w ago
nvm The issue is comming from the fact that since 6.6.0 you need to import Prisma from the place where prisma have generated the types (to have it, you need to check output in prisma.ts file)

Did you find this page helpful?