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.

`prisma generate` fails when using pnpm workspaces because it tries to install prisma dependencies with npm or yarn

See original GitHub issue

Bug 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

  1. Set up your repo to use pnpm workspaces and workspace: protocol in package.json (see https://pnpm.js.org/en/workspaces)
  2. Write a schema.
  3. 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:open
  • Created 3 years ago
  • Reactions:3
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

16reactions
keyworkscommented, Jan 29, 2021

Actually I just got past the issue by just manual installing @prisma/client in my local project. I ran: pnpm add @prisma/client.

7reactions
pantharshit00commented, May 4, 2021

This is still reproducible, we should add a special case for pnpm

Read more comments on GitHub >

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

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 Hashnode Post

No results found