Could not resolve @prisma/client despite the installation that we just tried.
See original GitHub issueBug 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:
- Created 2 years ago
- Reactions:8
- Comments:24 (5 by maintainers)
Top GitHub Comments
I switched to Typeorm
This happened to me because I only had
@prisma/client
installed, and I needed to also installprisma