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.

Error: @prisma/client did not initialize yet, another variant

See original GitHub issue

Bug description

This server has been working for a year with apollo, and last week I’ve been attempting to upgrade the libraries. This client error is well experienced on SO, but none of the solutions appear to work. The database is migrated properly, tables are present as expected.

How to reproduce

  1. Go to server directory
  2. Change package.json as given in env
  3. Run the following:
npm install
cd prisma
npx prisma migrate reset --preview-feature
npx prisma migrate dev --name init --preview-feature
npx prisma generate
npm run dev
  1. See Error
/server/node_modules/.prisma/client/index.js:1
Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues
    at new PrismaClient (/server/node_modules/.prisma/client/index.js:3:11)
    at Object.<anonymous> (/server_broke/src/services/accounts/index.js:11:19)
    at Generator.next (<anonymous>)
    at bl (/server/node_modules/esm/esm.js:1)
    at kl (/server/node_modules/esm/esm.js:1)
    at Object.u (/server/node_modules/esm/esm.js:1)
    at Object.o (/server/node_modules/esm/esm.js:1)
    at Object.<anonymous> (/server/node_modules/esm/esm.js:1)
    at Object.apply (/server/node_modules/esm/esm.js:1)
    at /server/node_modules/esm/esm.js:1

Node.js v17.3.0

Expected behavior

Expect prisma client to startup.

Prisma information

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

generator client {
  provider = "prisma-client-js"
  // previewFeatures = ["nativeTypes"]
}

model Account{
    id              Int             @default(autoincrement()) @id
    auth0           String          @default("")
    first_name       String          @default("")
    last_name        String          @default("")
    email           String
    created_at       DateTime        @default(now())
}

Environment & setup

  • OS:
  • Mac OS
  • Database: -MySQL - but it’s not starting up
  • Node.js version: % node -v v17.3.0
{
  "name": "apollo_server",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "dev": "concurrently -k npm:dev:*",
    "dev:accounts": "nodemon -r dotenv/config -r esm ./src/services/accounts/index.js",
    "dev:gateway": "wait-on tcp:4001 && nodemon -r dotenv/config -r esm ./src/index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "prisma": {
    "schema": "prisma/schema.prisma"
  },
  "dependencies": {
    "@apollo/federation": "^0.36.1",
    "@apollo/gateway": "^2.0.2",
    "@prisma/client": "^3.13.0",
    "apollo-server": "^3.7.0",
    "apollo-server-express": "^3.7.0",
    "auth0": "^2.40.0",
    "dotenv": "^16.0.0",
    "esm": "^3.2.25",
    "express": "^4.17.1",
    "express-jwt": "^7.7.0",
    "graphql": "^16.5.0",
    "graphql-middleware": "^6.1.26",
    "graphql-shield": "^7.4.2",
    "jwks-rsa": "^2.1.1",
    "jwt-decode": "^3.1.2",
    "nodemon": "^2.0.16",
    "sjcl": "^1.0.8",
    "wait-on": "^6.0.1"
  },
  "devDependencies": {
    "concurrently": "^7.1.0",
    "prisma": "^3.13.0"
  },
  "description": ""
}

Prisma Version


3.13.0

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
glariviecommented, May 11, 2022

Same with 3.11

0reactions
iconifyitcommented, Dec 10, 2022

I was able to fix this issue by changing the generator output location outside of the prisma directory. In my case I set it to ../generated. I think the reason this worked was because of the duplicate node_modules directories. I just bypassed the issue altogether.

generator client {
  provider = "prisma-client-js"
  output = "../generated"
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve the `prisma/client did not initialize yet` error on ...
Please run "prisma generate" and try to import it again. The database was already initialized from my local dev install, and I just...
Read more >
node.js - Error: @prisma/client did not initialize yet. Please run ...
I want to create a docker compose environment but I keep getting this error when I try to start my Prisma NodeJS app....
Read more >
Remix deployment fails because Error: @prisma/client did not ...
Error : @prisma/client did not initialize yet. Please run “prisma generate” and try to import it again. I have no idea why is...
Read more >
Why the Omicron offshoot BA.5 is a big deal - CNN
Dr. Fauci explains why new BA.5 subvariant is concerning ... The culprit this time is yet another Omicron offshoot, BA.5.
Read more >
Untitled
... Error: @prisma/client did not initialize yet, another variant Bug description ... Install Prisma Client in your project with the following command: npm ......
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found