Since v2.4 prisma generate no longer works in yarn workspaces
See original GitHub issueBug description
Running prisma generate
within yarn workspaces fails with the error:
Running this command will add the dependency to the workspace root rather than the workspace itself,
which might not be what you want - if you really meant it, make it explicit by running this command
again with the -W flag (or --ignore-workspace-root-check).
How to reproduce
- Set up yarn workspaces in your repo
- Set up prisma 2.4 (with prisma folder at root)
- npx prisma generate
Expected behavior
The prisma types should be generated successfully.
Environment & setup
- OS: Mac OS
- Database: PostgreSQL
- Node.js version: 14.4
- Prisma version: 2.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Since v2.4 prisma generate no longer works in yarn workspaces
This happens when you don't have @prisma/client in your dependencies . Adding the dependency fixes the issue! 2
Read more >Using Prisma with Turborepo
Since prisma generate usually only takes 5-6 seconds, and tends not to take longer with larger schema files, this seems like a fine...
Read more >Prisma CLI Command Reference
This page gives an overview of all available Prisma CLI commands, explains their options and shows numerous usage examples.
Read more >JavaScript package managers compared: npm, Yarn, or pnpm?
Although the type of application is not important for the topic ... Its successor, Yarn v2 or Berry, is now the active development...
Read more >Remix + multiple Prisma Express.js monorepo - Stack Overflow
*I'm sharing the Prisma generated typescript types from the backend to the Remix app through node_modules by installing the Prisma Client on ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pantharshit00 Yes, I am not saying it’s a bug, it’s just confusing in this edge case: initially, my project wasn’t in a monorepo setup, and everything was fine, because I had
@prisma/cli
installed in the only package I had. I forgot to install@prisma/client
, but it was not problematic, because, as you said, the CLI installs the client automatically.However, when I splitted my code as multiple packages, I installed
@prisma/cli
in the workspace root, and runningprisma generate
failed with the same error as OP. I think the CLI should warn us if@prisma/client
is not installed, instead of trying to install automatically when ran in a monorepo root - which will fail.This happens when you don’t have
@prisma/client
in yourdependencies
. Adding the dependency fixes the issue!