prisma: [Windows] "Photon binary for current platform windows could not be found" while running "npm run seed"
- Run
prisma2 init
- Choose template
TypeScript > GraphQL + Auth > SQLite
- Run
npm run seed
Result:
(node:7708) UnhandledPromiseRejectionWarning: Error: Photon binary for current platform windows could not be found.
Make sure to adjust the generator configuration in the schema.prisma file:
generator photon {
provider = "photonjs"
platforms = ["native", "windows"]
}
Please run prisma2 generate for your changes to take effect.
Note, that by providing `native`, Photon automatically resolves `windows`.
Read more about deploying Photon: https://github.com/prisma/prisma2/blob/master/docs/core/generators/photonjs.md
at NodeEngine.getPrismaPath (C:\Users\user\projects\playground\hello-prisma\node_modules\@generated\photon\runtime\index.js:3771:23)
(node:7708) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7708) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Tried to manually run prisma2 generate
and then npm run seed
. To no avail.
Prisma version: 2.0.0-preview-11 OS: Windows 10 Pro (x64) Node version: 10.16.2 NPM version: 6.9.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 25 (10 by maintainers)
@seed-of-apricot of course. In node_modules@generated\photon\runtime\index.js, search for the declaration for
alternativePath
(its in the getPrismaPath function at about line nbr 3770) and set its value toconst alternativePath = 'C:\\Users\\serotonyn\\project\\node_modules\\@generated\\photon\\runtime\\query-engine-windows.exe'
This now works fine with
preview-13
.Please let us know if this is not true for you, and we can reopen this issue and investigate further.
We currently think this might already be fixed by a pending change, will test and let you know when the change is available in
alpha
for confirmation.Short investigation into this:
The original error message
indeed comes from it not being able to get an
alternativePath
: https://github.com/prisma/photonjs/blob/36d275c42ad36bd20619d4e47b605cb0306c06d7/packages/engine-core/src/NodeEngine.ts#L210-L217We missed to adapt the
resolveAlternativeBinaryPath
method for Windows to add the necessary.exe
: https://github.com/prisma/photonjs/blob/36d275c42ad36bd20619d4e47b605cb0306c06d7/packages/engine-core/src/NodeEngine.ts#L170-L180But we probably also missed
resolvePrismaPath
https://github.com/prisma/photonjs/blob/36d275c42ad36bd20619d4e47b605cb0306c06d7/packages/engine-core/src/NodeEngine.ts#L147-L165 which would lead to this not even being triggered.Do you agree @divyenduz? Should be simple enough to fix in a quick PR from me.
(We should probably double check all mentions of
query-engine-
in the codebase for this)@serotonyn That worked, thank you!
@serotonyn Could you please tell me how to set the alternative path?