prisma: [Windows] Invalid `photon.()` invocation ... Photon binary for current platform windows could not be found.

I’ve created a blank new repo using npx prisma2 init hello-prisma2. It downloaded the newest prisma2 2.0.0-preview-12 which should have support for windows.

First of all, I have to manually call npm install to download the remaining packages. Then it downloaded the windows binary:

> prisma2@2.0.0-preview-12 install F:\#Projekty\#JS\hello-prisma2\node_modules\prisma2
> node download-build/index.js || echo ""

> Downloading windows binary [====================] 100%

And it generated a Photon.js Client sucessfully. After trying to run this app by npm start, it failed with this console info:

Error: 
Invalid `photon.()` invocation in F:\#Projekty\#JS\hello-prisma2\script.ts:8:36

Photon binary for current platform windows could not be found.
  Make sure to adjust the generator configuration in the schema.prisma file:
generator photon {
  platforms = ["native"]
}
  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 PhotonFetcher.<anonymous> (F:\#Projekty\#JS\hello-prisma2\node_modules\@generated\photon\index.js:46:27)
    at Generator.throw (<anonymous>)
    at rejected (F:\#Projekty\#JS\hello-prisma2\node_modules\@generated\photon\index.js:5:65)
(node:43808) 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"
}
  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 (F:\#Projekty\#JS\hello-prisma2\node_modules\@generated\photon\runtime\index.js:3777:23)
    at F:\#Projekty\#JS\hello-prisma2\node_modules\@generated\photon\runtime\index.js:3828:36
(node:43808) 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:43808) [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.

So I’ve edited that photon generator block, run npm install again and then received the new error message:

Photon binary for current platform windows could not be found.
  Make sure to adjust the generator configuration in the schema.prisma file:
generator photon {
  platforms = ["native", "windows"]
}
  Please run prisma2 generate for your changes to take effect.

But after that change, it now trows an error during prisma2 generate step:

Generating Photon.js Client to F:\#Projekty\#JS\hello-prisma2\node_modules\@generated\photon
Error: Unknown platform windows. Possible platforms: native, darwin, linux-glibc-libssl1.0.1, linux-glibc-libssl1.0.2, linux-glibc-libssl1.1.0, linux-musl-libssl1.1.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

This should be fixed now in the just release preview-13 - I just tested it and could not trigger this error again 🚀

Newest being alpha.206 here, right?

I still encounter the original problem:

C:\Users\Jan\Documents\throwaway\585  (script@1.0.0)
λ npm start

> script@1.0.0 start C:\Users\Jan\Documents\throwaway\585
> node ./script.js

Error:
Invalid `const user1 = await photon.users.create()` invocation in C:\Users\Jan\Documents\throwaway\585\script.js:7:36

   3
   4 // A `main` function so that we can use async/await
   5 async function main() {
   6   // Seed the database with users and posts
→  7   const user1 = await photon.users.create(

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"]
}
  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 PhotonFetcher.<anonymous> (C:\Users\Jan\Documents\throwaway\585\node_modules\@generated\photon\index.js:46:27)
    at Generator.throw (<anonymous>)
    at rejected (C:\Users\Jan\Documents\throwaway\585\node_modules\@generated\photon\index.js:5:65)
(node:26456) 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"]
}
  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\Jan\Documents\throwaway\585\node_modules\@generated\photon\runtime\index.js:3777:23)
    at async C:\Users\Jan\Documents\throwaway\585\node_modules\@generated\photon\runtime\index.js:3828:36
(node:26456) 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:26456) [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.

C:\Users\Jan\Documents\throwaway\585  (script@1.0.0)
λ prisma2 -v
prisma2@2.0.0-alpha.206, binary version: 14576370b55d5152d9cb90f4f509bfa56760dbbd

~Came here to add that I was also experiencing this issue on MacOS (darwin), and can confirm it’s resolved on prisma2@2.0.0-alpha.204, incase anyone else finds themselves here when investigating this issue locally.~

~Looks like I was wrong here. I’m seeing these failures on MacOS on the latest alpha of prisma2.~

Turns out it was an issue with my tooling on my end.