`prisma generate` fails when using pnpm workspaces because it tries to install prisma dependencies with npm or yarn
See original GitHub issueBug description
prisma migrate dev
appears to be running npm to install @prisma/cli
but it fails since my project is a pnpm project.
How to reproduce
- Set up your repo to use pnpm workspaces and
workspace:
protocol in package.json (see https://pnpm.js.org/en/workspaces) - Write a schema.
- Run the initial migration:
pnpx prisma migrate dev --name init --preview-feature
I get the following error:
myapp (master *) $ pnpx prisma migrate dev --name init --preview-feature
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "dev.db" at "file:./dev.db"
SQLite database dev.db created at file:./dev.db
The following migration(s) have been created and applied from new schema changes:
migrations/
└─ 20210129014823_init/
└─ migration.sql
Running generate... (Use --skip-generate to skip the generators)
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:^0.4.0
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jkim/.npm/_logs/2021-01-29T01_48_26_656Z-debug.log
Error: Command failed with exit code 1: npm install -D @prisma/cli@2.15.0
Expected behavior
No error
Environment & setup
- OS: MacOS
- Database: SQLite
- Node.js version: v10.22.0
- Prisma version: 2.15.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:20 (7 by maintainers)
Top Results From Across the Web
Workspace | pnpm
So, if you set "foo": "workspace:2.0. 0" , this time installation will fail because "foo@2.0.0" isn't present in the workspace. This protocol is...
Read more >Generating the client (Concepts) - Prisma
This page explains how to generate Prisma Client. It also provides additional context on the generated client, typical workflows and Node.js configuration.
Read more >next-transpile-modules - npm
The way to fix it is easy, and it is what you should always do: install your dependencies with npm ci ("clean install")...
Read more >JavaScript package managers compared: npm, Yarn, or pnpm?
This is achieved through a node_modules layout, using symlinks to create a nested structure of dependencies, where every file of every package ...
Read more >NPM Workspaces with two or more @prisma/client ...
The thing is that whenever i change something in my schema.prisma file (e.g. in my-first-project) and run npx prisma migrate dev --name whatever ......
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
Top Related Hashnode Post
No results found
Actually I just got past the issue by just manual installing @prisma/client in my local project. I ran:
pnpm add @prisma/client
.This is still reproducible, we should add a special case for pnpm