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.

Could not resolve @prisma/client despite the installation that we just tried.

See original GitHub issue

Bug description

I’ve come back to work on a product again after a couple of weeks and it broke (again) which I guess just happens as prisma is evolving quickly but this one I couldn’t figure out the fix.

Locally, it generates fine still, but in the Docker image which our backend deploys it throws this after yarn dlx prisma generate

Error: Could not resolve @prisma/client despite the installation that we just tried.
Please try to install it by hand with npm install @prisma/client and rerun prisma generate 🙏.

(Which I tried and doesn’t make any difference)

I also tried installing prisma globally with npm i -g prisma and the same issue occurs. Same with npx prisma generate too.

npx prisma results in this:

root@53e11231ecb9:/api# npx prisma
internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module '/root/.npm/_npx/141/lib/node_modules/prisma/scripts/preinstall-entry.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! prisma@2.23.0 preinstall: `node scripts/preinstall-entry.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the prisma@2.23.0 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-05-23T17_55_36_862Z-debug.log
Install for [ 'prisma@latest' ] failed with code 1

I did manage to get it to work once by running the yarn dlx command twice, but I can’t remember how, it’s been a few hours now!

Are there any specific changes that happened in the last few weeks that I need to make changes for?

One aspect of this project is that it’s a multi-tenant yarn workspaces repo with a few different packages inside, but the root package includes prisma as a dependency and @prisma/client as a dev dependency (which I’m not sure why, I think it solved another similar issue a couple of months back)

How to reproduce

It’s probably project specific, but just running generate triggers it.

Expected behavior

No response

Prisma information

Schema isn’t relevant. It generates fine on development machine (mac)

Environment & setup

  • OS: Building a Docker image (based on golang:latest)
  • Node.js version: 12.18.3

Prisma Version

prisma               : 2.23.0
@prisma/client       : 2.23.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine adf5e8cba3daf12d456d911d72b6e9418681b28b (at ../usr/local/nvm/versions/node/v12.18.3/lib/node_modules/prisma/node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli adf5e8cba3daf12d456d911d72b6e9418681b28b (at ../usr/local/nvm/versions/node/v12.18.3/lib/node_modules/prisma/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core adf5e8cba3daf12d456d911d72b6e9418681b28b (at ../usr/local/nvm/versions/node/v12.18.3/lib/node_modules/prisma/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt adf5e8cba3daf12d456d911d72b6e9418681b28b (at ../usr/local/nvm/versions/node/v12.18.3/lib/node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : adf5e8cba3daf12d456d911d72b6e9418681b28b
Studio               : 0.393.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:8
  • Comments:24 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
bugwheels94commented, May 17, 2022

This happens in npm workspaces too. In npm workspace the deps are installed on the parent directory while @prisma/client appears locally for some reason

did you fix it?

I switched to Typeorm

3reactions
sarinkcommented, Oct 6, 2022

This happened to me because I only had @prisma/client installed, and I needed to also install prisma

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Could not resolve @prisma/client despite the installation ...
I'm getting this error when I run “yarn rw deploy vercel”: Error: Could not resolve @prisma/client despite the installation that we just tried....
Read more >
Error: Could not resolve @prisma/client despite the installation that ...
Running npx prisma generate yields the following error. Error: Could not resolve @prisma/client despite the installation that we just tried. Please try to ......
Read more >
prisma/client did not initialize yet. Please run "prisma generate ...
prisma and have to use npx prisma generate . The solution for me is to restart the node application running npm start again....
Read more >
Install Prisma Client | node-mysql
Install and generate Prisma Client. To get started with Prisma Client, you need to install the @prisma/client package:.
Read more >
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 >

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