Samuel Corsi-House
09/16/2022, 10:16 PM❯ yarn prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "patch:": patch:@trivago/prettier-plugin-sort-imports@npm%3A3.3.0#~/.yarn/patches/@trivago-prettier-plugin-sort-imports-npm-3.3.0-b578e89971.patch
npm ERR! A complete log of this run can be found in:
npm ERR! /home/xenfo/.npm/_logs/2022-09-16T22_07_41_297Z-debug-0.log
Error: Command failed with exit code 1: npm install @prisma/client@4.3.1
Why is Prisma trying to use NPM when I used Yarn to execute?Kevin Reed
09/16/2022, 11:59 PMyarn prisma generate
you're using a script that you can find inside the node_modules folder. Did some digging and it looks like the generate script is in ~/node_modules/@prisma/client/scripts/postinstall.js
documentation starts on line 53 for version ^4.3.1
In that you can see
try {
if (localPath) {
await run('node', [localPath, 'generate', '--postinstall', doubleQuote(getPostInstallTrigger())])
return
}
if (installedGlobally) {
await run('prisma', ['generate', '--postinstall', doubleQuote(getPostInstallTrigger())])
return
}
} catch (e) {
// if exit code = 1 do not print
if (e && e !== 1) {
console.error(e)
}
debug(e)
}
If you go to the getPostInstallTrigger()
function definition you can follow the logic down to the parsePackageManagerName()
function which seems like it should be grabbing and using yarn
. Yarn and npm usage isn't syntactically identical so there could just be some missing handler logic. I could be way off on diagnosing the issue but I figured I'd chime in to maybe give you a place to look at, I've always just used npx for prisma scripts and I've never had any issues.Kevin Reed
09/17/2022, 12:09 AM@prisma/client
and prisma
installedSamuel Corsi-House
09/17/2022, 2:11 AM