Cannot find module '.prisma/client/default' #28129
Replies: 1 comment
-
|
Like to update this as I needed to update my prisma to the latest version to be able to take advantage of the new provider However, the error returned. So I opted to generating two clients, one with Schema: generator appClient {
provider = "prisma-client-js"
}
generator workerClient {
provider = "prisma-client"
output = "./generated/prisma-client"
moduleFormat = "esm"
}Then I just export the clients like so: export {
Prisma,
PrismaClient as PrismaClient_Worker,
...
} from './prisma/generated/prisma-client/client';
export {
PrismaClient as PrismaClient_App
} from "@prisma/client";
export * from "./types";The app uses only the generated Hope this helps. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Okay, I wanted to share what causes this problem and hopefully a fix, as I've spent a couple hours figuring this out.
Error:
Note, after messing around with things in my project, I've seen this message come in different forms, but I believe its the same root issue.
My setup:
PrismaClientfromprisma/clientfor their associated apps and other packages to consume.PrismaClientCause of problem:
The issue was that there were two generated prisma folders in
monorepo-root/node_modules/.pnpm, example:I'm unsure as to why there were two. When generating the prisma client for each app it overwrites the other, so it wasn't like a folder is created for each app, which all apps are on the same version via pnpms catalogs.
So when external dependencies required the generated client, it can access the wrong folder thus prompting this error.
Solution:
pnpm-lock.yamland clear rootnode_modulespnpm installat the rootNow only one
@prisma+client@VERSION_prisma_...should be created inmonorepo-root/node_modules/.pnpm.Beta Was this translation helpful? Give feedback.
All reactions