question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Since v2.4 prisma generate no longer works in yarn workspaces

See original GitHub issue

Bug 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

  1. Set up yarn workspaces in your repo
  2. Set up prisma 2.4 (with prisma folder at root)
  3. 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:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
marvinrogercommented, Sep 28, 2020

@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 running prisma 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.

2reactions
marvinrogercommented, Sep 26, 2020

This happens when you don’t have @prisma/client in your dependencies. Adding the dependency fixes the issue!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found