Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Prisma with pnpm results in inability to call database related commands #18238

Closed
lamaqdahodwala opened this issue Mar 6, 2023 · 5 comments · Fixed by #18646
Closed
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: pnpm
Milestone

Comments

@lamaqdahodwala
Copy link

lamaqdahodwala commented Mar 6, 2023

Bug description

I am using pnpm with Prisma in my app, but whenever I try running prisma migrate dev or prisma generate, the program hangs for about 10 minutes before returning an error.

Running generate... (Use --skip-generate to skip the generators)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @eslint/eslintrc@2.0.0
npm WARN Found: peer eslint-plugin-jsdoc@">=22.1.0" from eslint-config-eslint@7.0.0
npm WARN node_modules/.pnpm/@eslint+eslintrc@2.0.0/node_modules/@eslint/eslintrc/node_modules/eslint-config-eslint
npm WARN   dev eslint-config-eslint@"^7.0.0" from @eslint/eslintrc@2.0.0
npm WARN   node_modules/.pnpm/@eslint+eslintrc@2.0.0/node_modules/@eslint/eslintrc
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-jsdoc@">=22.1.0" from eslint-config-eslint@7.0.0
npm WARN node_modules/.pnpm/@eslint+eslintrc@2.0.0/node_modules/@eslint/eslintrc/node_modules/eslint-config-eslint
npm WARN   dev eslint-config-eslint@"^7.0.0" from @eslint/eslintrc@2.0.0
npm WARN   node_modules/.pnpm/@eslint+eslintrc@2.0.0/node_modules/@eslint/eslintrc
npm ERR! Cannot read properties of null (reading 'matches')

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-03-06T21_07_48_240Z-debug-0.log
Error: Command failed with exit code 1: npm install @prisma/client@4.11.0

How to reproduce

  1. Install Prisma using pnpm
  2. Write some models in the Prisma schema
  3. Run pnpm prisma migrate dev or pnpm prisma generate

Expected behavior

I expected Prisma to play nicely with the pnpm format, but it didn't. It seems like the problem might be a mismatch between the usage of pnpm and npm when installing @prisma/client, because even on my pnpm project, it still says that npm install @prisma/client was used.

Prisma information

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")
}

model User {
  id Int @id @default(autoincrement())
  username String @unique
  password String
  
}

Environment & setup

  • OS: WSL
  • Database: SQLite
  • Node.js version: 18.12.1

Prisma Version

4.11.0
@lamaqdahodwala lamaqdahodwala added the kind/bug A reported bug. label Mar 6, 2023
@ghost
Copy link

ghost commented Mar 9, 2023

I had the same issue. Good catch on spotting how @prisma/client was installed. After manually adding the package through pnpm (pnpm add @prisma/client) everything works again. pnpm prisma generate takes barely a second and generates a new Prisma Client as intended.

https://www.prisma.io/docs/reference/api-reference/command-reference#generate

The documentation does mention that prisma generate will install the @prisma/client package if not already present:

Installs the @prisma/client into the npm project if it is not already present.

TL;DR: pnpm add @prisma/client will fix this.

@janpio janpio added topic: pnpm team/client Issue for team Client. bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Mar 13, 2023
@tobychidi
Copy link

Ran into this issue for the first time today. I feel I have been using pnpm and prisma before without issues?

@millsp
Copy link
Member

millsp commented Apr 14, 2023

Hey folks, we have just improved our pnpm detection logic to fix this issue, and we will release this in our 4.13.0 release. That said, you can try it now by installing our dev version. npm install prisma@dev. Feedback welcome!

@mertcankurt
Copy link

mertcankurt commented Dec 7, 2023

Hello, this issue seems to have returned with version 5.7.0. When i install prisma with pnpm, @prisma/client is not installed. Could you check the issue when you are available ?

@millsp
Copy link
Member

millsp commented Dec 7, 2023

Hey @mertcankurt, could you please open a new issue and give us more details about your setup, and maybe a small repro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: pnpm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants