Hi all, I't trying to package a node.js applicatio...
# prisma-client
b
Hi all, I't trying to package a node.js application that uses prisma into a single executable file, but I am having problems with the prisma client. It seems that the client binary is not found within the .exe or for some reason doesn't work. I tried it with https://github.com/vercel/pkg as well as https://github.com/nexe/nexe, but with the same result. Does anyone have experiences with this and maybe has a hint?
It's not pretty though.
We use it for #prisma-client-go and are not super happy about it really, but 🤷‍♀️
b
thx for the quick answer, i will check it out!
i followed your workaround to copy the engine binaries and also explicitly set PRISMA_QUERY_ENGINE_BINARY. it's still not working, but at least I now get a different error message 😅
before:
Copy code
"\nInvalid `prisma.user.findMany()` invocation:\n\n\n  spawn C:\\snapshot\\myProject\\node_modules\\.prisma\\client\\query-engine-windows.exe ENOENT"
now:
Copy code
"\nInvalid `prisma.user.findMany()` invocation:\n\n\n  Query engine binary for current platform \"windows\" could not be found.\nThis probably happens, because you built Prisma Client on a different platform.\n(Prisma Client looked in \"C:\\\\snapshot\\\\myProject\\\\node_modules\\\\prisma\\\\node_modules\\\\@prisma\\\\engines\\\\query-engine-windows.exe\")\n\nSearched Locations:\n\n\n\n\nTo solve this problem, add the platform \"undefined\" to the \"binaryTargets\" attribute in the \"generator\" block in the \"schema.prisma\" file:\ngenerator client {\n  provider      = \"prisma-client-js\"\n  binaryTargets = [\"native\", \"windows\"]\n}\n\nThen run \"prisma generate\" for your changes to take effect.\nRead more about deploying Prisma Client: <https://pris.ly/d/client-generator>"
Copy code
add the platform \"undefined\"
seems to be the problem.... but I have no idea what to do about it
j
Yeah that error message is probably just not the best.
What platform are you building on? And then running on?
b
both on windows
j
Ok, now I notice: The
pkg
binary is mostly meant for the Prisma CLI, not the Client which you seem to try to use here.
(Sorry for not noticing that earlier)
Can you share how you are trying to bundle your app, maybe with a reproduction repository? Then you can jsut create an issue on our side and maybe we can take a look.
At the same time, this is definitely not one of our supported use cases so this might just not be possible - but we can try.
b
ok, will do... thanks anyway!
I created this small repo which should make is possible to reproduce what I'm trying to do https://github.com/whmube/pkg-with-prisma-client
👍 1