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

Automatic installation of missing dependencies isn't compatible with pnpm #14401

Closed
Tracked by #23
behrangsa opened this issue Jul 20, 2022 · 3 comments · Fixed by #18646
Closed
Tracked by #23

Automatic installation of missing dependencies isn't compatible with pnpm #14401

behrangsa opened this issue Jul 20, 2022 · 3 comments · Fixed by #18646
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: pnpm topic: prisma generate CLI: prisma generate
Milestone

Comments

@behrangsa
Copy link

behrangsa commented Jul 20, 2022

Bug description

PNPM: https://pnpm.io

When I follow the getting started guide but use PNPM instead of NPM, pnpx fails at the migrate step:

$ pnpx prisma migrate dev --name init

How to reproduce

  1. Follow the steps here, but using PNPM instead of NPM: https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-postgres
  2. The migrate step fails:
PS C:\Users\Behrang\Documents\Projects\github.com\behrangsa\xyz-doodles\doodle-5> pnpx prisma migrate dev --name init
.../Local/pnpm/store/v3/tmp/dlx-24148    |   +2 +
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: C:\Users\Behrang\AppData\Local\pnpm\store\v3
  Virtual store is at:             ../../../../../../AppData/Local/pnpm/store/v3/tmp/dlx-24148/node_modules/.pnpm
.../Local/pnpm/store/v3/tmp/dlx-24148    | Progress: resolved 2, reused 2, downloaded 0, added 2, done
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "mydb", schema "public" at "localhost:49154"

PostgreSQL database mydb created at localhost:49154

Applying migration `20220720081027_init`

The following migration(s) have been created and applied from new schema changes:

migrations/
  └─ 20220720081027_init/
    └─ migration.sql

Your database is now in sync with your schema.

Running generate... (Use --skip-generate to skip the generators)
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm ERR! Cannot read properties of null (reading 'isDescendantOf')

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Behrang\scoop\persist\nodejs\cache\_logs\2022-07-20T08_10_30_080Z-debug-0.log
Error: Command failed with exit code 1: npm install @prisma/client@4.1.0
 ERROR  Command failed with exit code 1: C:\Users\Behrang\AppData\Local\pnpm\store\v3\tmp\dlx-24148\node_modules\.bin\prisma.CMD migrate dev --name init

2022-07-20T08_10_30_080Z-debug-0.log

Expected behavior

Prisma to work with PNPM.

Prisma information

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

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

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

model Post {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String   @db.VarChar(255)
  content   String?
  published Boolean  @default(false)
  author    User     @relation(fields: [authorId], references: [id])
  authorId  Int
}

model Profile {
  id     Int     @id @default(autoincrement())
  bio    String?
  user   User    @relation(fields: [userId], references: [id])
  userId Int     @unique
}

model User {
  id      Int      @id @default(autoincrement())
  email   String   @unique
  name    String?
  posts   Post[]
  profile Profile?
}

Environment & setup

  • OS: Windows 11
  • Database: PostgreSQL
  • Node.js version: v18.4.0

Prisma Version

.../Local/pnpm/store/v3/tmp/dlx-33356    |   +2 +
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: C:\Users\Behrang\AppData\Local\pnpm\store\v3
  Virtual store is at:             ../../../../../../AppData/Local/pnpm/store/v3/tmp/dlx-33356/node_modules/.pnpm
.../Local/pnpm/store/v3/tmp/dlx-33356    | Progress: resolved 2, reused 2, downloaded 0, added 2, done
Environment variables loaded from .env
prisma                  : 4.1.0
@prisma/client          : Not found
Current platform        : windows
Query Engine (Node-API) : libquery-engine 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at ..\..\..\..\..\..\AppData\Local\pnpm\store\v3\tmp\dlx-33356\node_modules\.pnpm\@prisma+engines@4.1.0\node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine        : migration-engine-cli 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at ..\..\..\..\..\..\AppData\Local\pnpm\store\v3\tmp\dlx-33356\node_modules\.pnpm\@prisma+engines@4.1.0\node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine    : introspection-core 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at ..\..\..\..\..\..\AppData\Local\pnpm\store\v3\tmp\dlx-33356\node_modules\.pnpm\@prisma+engines@4.1.0\node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary           : prisma-fmt 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at ..\..\..\..\..\..\AppData\Local\pnpm\store\v3\tmp\dlx-33356\node_modules\.pnpm\@prisma+engines@4.1.0\node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash    : 8d8414deb360336e4698a65aa45a1fbaf1ce13d8
Studio                  : 0.467.0
@behrangsa behrangsa added the kind/bug A reported bug. label Jul 20, 2022
@aqrln aqrln added topic: prisma generate CLI: prisma generate team/client Issue for team Client. topic: pnpm bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Jul 20, 2022
@aqrln
Copy link
Member

aqrln commented Jul 20, 2022

I can confirm this, the guide omits the step where @prisma/client should be installed, and the automatic installation of missing dependencies in prisma doesn't support pnpm.

Please run pnpm add @prisma/client manually, and the retry pnpx prisma generate (it's the generate step which actually failed after being automatically invoked by prisma migrate, migration itself completed successfully).

@JordanGibson
Copy link

I can confirm this, the guide omits the step where @prisma/client should be installed, and the automatic installation of missing dependencies in prisma doesn't support pnpm.

Please run pnpm add @prisma/client manually, and the retry pnpx prisma generate (it's the generate step which actually failed after being automatically invoked by prisma migrate, migration itself completed successfully).

I was experiencing the same issue when trying to generate the client, this solution works for me. Thanks @aqrln - this should probably be added to the docs.

@aqrln aqrln changed the title Prisma doesn't seem to be compatible with pnpm Automatic installation of missing dependencies isn't compatible with pnpm Jul 27, 2022
@millsp millsp added this to the 4.13.0 milestone Apr 14, 2023
@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: pnpm topic: prisma generate CLI: prisma generate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants