docs icon indicating copy to clipboard operation
docs copied to clipboard

Install completely broken with `yarn pnpify`

Open joshribakoff opened this issue 2 years ago β€’ 4 comments

Bug description

Your "generate" command is trying to force me to put prisma as a dev dependency. That is wrong, it is a dependency. Nevertheless, it doesn't work. If you move it to dev dependencies, you get an inverse/circular error telling you to change it back to a regular dependency.

How to reproduce

Just yarn add prisma and run yarn prisma generate:

➜  git:(main) βœ— yarn prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Usage Error: Package "prisma" is already listed as a regular dependency - remove the -D,-P flags or remove it from your dependencies first

$ yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--mode #0] ...
Error: Command failed with exit code 1: yarn add -D [email protected]


Error: Could not resolve @prisma/client despite the installation that we just tried.
Please try to install it by hand with yarn add @prisma/client and rerun yarn prisma generate πŸ™.


➜ git:(main) βœ— yarn remove prisma
➜  git:(main) βœ— yarn add -D prisma  
➜  git:(main) βœ— yarn prisma generate
Error: Could not resolve @prisma/client despite the installation that we just tried.
Please try to install it by hand with yarn add @prisma/client and rerun yarn prisma generate πŸ™.

Expected behavior

Generate the client, do not mess with me dependencies

Prisma information

n/a

Environment & setup

  • OS: macOS,
  • Database: n/a
  • Node.js version: 18.14.1

Prisma Version

4.10.1

joshribakoff avatar Feb 25 '23 17:02 joshribakoff

By the way, if it is your claim I'm using an unsupported setup or it's a duplicate "yarn issue" or something, I would in turn ask you why your error message is so unhelpful.

joshribakoff avatar Feb 25 '23 18:02 joshribakoff

Yep, of course switching from pnp to node-modules fixed it, but I am using pnpify and custom prisma output locations in other projects. Because of this issue, I cannot replicate my previously working setup, even w/ the same versions of prisma, yarn, etc. :/

Eventually I solved it - had to run yarn pnpify prisma generate instead of yarn prisma generate.

Perhaps this issue could be renamed "please add documentation for pnpify workarounds" or "improve error messages when users try to use pnp in unsupported manner"

joshribakoff avatar Feb 25 '23 18:02 joshribakoff

Eventually I solved it - had to run yarn pnpify prisma generate instead of yarn prisma generate.

This worked for me! Except I had to install pnpify first with yarn add @yarnpkg/pnpify. I'm using yarn 3.5.0.

cybermelons avatar Apr 10 '23 03:04 cybermelons

Related: https://github.com/prisma/prisma/issues/8765#issuecomment-1854451597

zach-betz-hln avatar Jan 17 '24 15:01 zach-betz-hln

Hey everyone πŸ‘‹ thanks a lot for the lively discussion in this issue! After reading through everything, I believe that the main issue here stemmed from the usage of PnPify which seems to be deprecated now.

Hence, I'll close this issue since we're not documenting workarounds for deprecated tooling. If you still think that we should update our docs, please feel free to re-open the issue with specific information about what kind of updates you'd like to see πŸ™

nikolasburk avatar Nov 27 '24 12:11 nikolasburk

I do not think I have the ability to reopen the issue. I would contend that the main issue stems from the fact you have re-implemented the module resolution instead of using the language’s built in module resolution. Accordingly, I still think it would make sense to document what you were doing that is non-standard, and why. Just because one tool that this created conflicts with is now technically deprecated doesn’t mean people still aren’t using that deprecated tool for various reasons or may run into issues with your non-standard approach, even if they were using different tooling.

joshribakoff avatar Nov 29 '24 19:11 joshribakoff