Problem
This is a situation that can happen:
--- yarn prisma -v ---
warning package.json: No license field
prisma : 2.26.0-dev.7
@prisma/client : 2.26.0-dev.7
Current platform : debian-openssl-1.1.x
Query Engine : query-engine c838e79f39885bc8e1611849b1eb28b5bb5bc922 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine : migration-engine-cli c838e79f39885bc8e1611849b1eb28b5bb5bc922 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core c838e79f39885bc8e1611849b1eb28b5bb5bc922 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt c838e79f39885bc8e1611849b1eb28b5bb5bc922 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : c838e79f39885bc8e1611849b1eb28b5bb5bc922
Studio : 0.402.0
--- ls node_modules/@prisma/engines/ ---
ls: cannot access 'node_modules/@prisma/engines/': No such file or directory
As you can see yarn prisma -v tells us the engines comes from node_modules/@prisma/engines, but when you try to list that directory, it is actually not present.
What is happening here is that yarn prisma is actually from a few folders above our project. This is kinda visible when you look to not run yarn -s but just yarn:
codespace ➜ /workspaces/e2e-tests/platforms-serverless/firebase-functions (janpio-patch-5 ✗) $ yarn prisma -v
yarn run v1.22.10
warning package.json: No license field
$ /workspaces/e2e-tests/node_modules/.bin/prisma -v
prisma : 2.25.0-dev.36
@prisma/client : 2.25.0-dev.36
...
Suggested solution
Output the directory of where the executed prisma is from, either similar to Yarn the absolute path to the binary in node_modules, or the folder where the package.json that is responsible for the installation of Prisma comes from.
Alternatives
Rely on yarn itself to give that information. Will not work with npx unfortunately for example.
Problem
This is a situation that can happen:
As you can see
yarn prisma -vtells us the engines comes fromnode_modules/@prisma/engines, but when you try to list that directory, it is actually not present.What is happening here is that
yarn prismais actually from a few folders above our project. This is kinda visible when you look to not runyarn -sbut justyarn:Suggested solution
Output the directory of where the executed
prismais from, either similar to Yarn the absolute path to the binary innode_modules, or the folder where thepackage.jsonthat is responsible for the installation of Prisma comes from.Alternatives
Rely on
yarnitself to give that information. Will not work withnpxunfortunately for example.