Does declaring ‘prisma-client’ in a provider eliminate the need to install @prisma/client?

v6.10.1
generator client {
provider = "prisma-client"
output = "../core/database/generated/prisma"
moduleFormat = "cjs"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client"
output = "../core/database/generated/prisma"
moduleFormat = "cjs"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
I can create it in the root directory via @prisma-client, which is great because it speeds up caching. However, if I don't install @prisma/client, I get an error. Is this normal?
7 Replies
Prisma AI Help
Prisma AI Help6mo ago
Skipping coffee for instant knowledge! Let's brew that AI answer now. Declaring provider = "prisma-client" (or "prisma-client-js") in your generator block does not eliminate the need to install @prisma/client. Even if you generate the client to a custom output directory, the @prisma/client package is still required as a dependency for your project to import and use the generated Prisma Client in your code. Multiple issues and discussions confirm that if @prisma/client is not installed, you will encounter errors when trying to use the generated client, regardless of the output path or provider setting. The Prisma CLI does not automatically install @prisma/client for you in recent versions, so you must add it manually (e.g., with npm install @prisma/client or yarn add @prisma/client) Prisma issue #7650, Prisma issue #7579, Prisma issue #14565. This is expected behavior. The @prisma/client package contains the runtime code needed to use the generated client, and simply generating the client code elsewhere does not provide this runtime. If you want to use a custom output path, you must also adjust your imports accordingly, but the dependency on @prisma/client remains unless you are re-exporting the generated client from another package and handling all runtime requirements yourself, which is an advanced and non-standard setup Prisma issue #13672. In summary: Yes, it is normal that you get an error if you do not install @prisma/client, even when using a custom provider or output. 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
jonfanz
jonfanz6mo ago
The bot is right. You still need @prisma/client
inhanbyeol
inhanbyeolOP6mo ago
If I use an adapter, do I still need a client?
jonfanz
jonfanz6mo ago
You don’t import from @prisma/client but you still need the package in your dependencies
inhanbyeol
inhanbyeolOP6mo ago
Thank you so much for the very quick response, I'm amazed at your feedback speed 🙂
inhanbyeol
inhanbyeolOP6mo ago
So you're blocking prisma@client from fetching? This is why Intellijay caching is very slow
No description
jonfanz
jonfanz6mo ago
Not quite sure what you’re asking. But the generated client is the correct path. Maybe opening a GitHub discussion or issue would be better? The ORM team would take a look then

Did you find this page helpful?