prisma: `npx prisma generate` hangs after upgrading `@prisma/client` from 3.0.2

Bug description

Running npx prisma generate from postinstall hangs on 3.4.2. Used to work fine with 3.0.2:

> npx prisma generate

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
^C

I had to CTRL+C out of it.

I upgraded @prisma/client from 3.0.2 to latest (3.4.2) and after that upgrade, the generate command just hangs.

Using:

{
  "dependencies": {
    "@prisma/client": "^3.4.2",
    "graphql": "^15.5.3",
    "nexus": "^1.1.0",
    "nexus-prisma": "^0.34.0"
  }
}

(stripped dependencies I didn’t think were relevant)

How to reproduce

  • Upgrade prisma from 3.0.2 to 3.4.2
  • Run npx prisma generate
  • Observe: it just hangs

Expected behavior

Expect it to complete successfully like it used to do before

In the changeset I made for my project are only 2 files:

  • package.json
  • package-lock.json

The diff for package.json shows only the @prisma/client version number as changed.

Prisma information

generator client { provider = “prisma-client-js” }

generator nexusPrisma { provider = “nexus-prisma” }

datasource db { provider = “mysql” url = env(“DATABASE_URL”) }

Environment & setup

  • OS: MacOS
  • Database: MySQL
  • Node.js version: v16.13.0

Prisma Version

prisma                  : 3.0.2
@prisma/client          : 3.4.2
Current platform        : darwin-arm64
Query Engine (Node-API) : libquery-engine 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine        : migration-engine-cli 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine    : introspection-core 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary           : prisma-fmt 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Default Engines Hash    : 2452cc6313d52b8b9a96999ac0e974d0aedf88db
Studio                  : 0.423.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

For anyone using pnpm and looking for a workaround, you can fix the missing dep via `.pnpmfile.cjs’:

module.exports = {
  hooks: {
    readPackage: (pkg) => {
      if (pkg.name === 'floggy') {
        pkg.dependencies['chalk'] = '^4.1.2';
      }
      return pkg;
    }
  }
};

@janpio Interesting. Adding the missing .env file is clearly what solved it for me because I did nothing else, but now that it has worked once, it still works even if I remove that .env file. This is on M1 mac, which it looks like the original issue was too, so my first thought was something related to that. (It causes a lot of subtle bugs.) Could be something deeper like that and altering the filesystem just happened to resolve it. (This was a project I had freshly cloned from a coworker.) 🤷🏻‍♂️

This might be adjacent but I ran into the same issue but it was because I hadn’t installed @prisma/client and only installed the prisma CLI.

Followed this https://www.prisma.io/docs/getting-started/quickstart after I decided to refactor out of GraphQL on my Next website (to be honest I don’t understand it well enough to know how to properly use middleware to secure the GrapQL endpoints).

So anyone who still has this issue might want to check that they installed the client in the environment they are working in.

Yeah I understand. I will see if I can add some model defs to the schema that trigger the bug. Thanks for your quick responses, much appreciated!