Prisma in deno
I've been having a weird problem with Prisma, when running 100% on deno. Prisma mostly assumes you have a
package.json
in your project and the biggest problem is that deno just doesn't use it.
When I try to run something like prisma generate
, it shows the Warning: [Prisma auto-install on generate] Prisma could not find a package.json file in the inferred project root Coding\JS\norslo. During the next step, when an auto-install of Prisma package(s) will be attempted, it will then be created by your package manager on the appropriate level if necessary.
, then just hangs forever (yes, I've waited for a while for it).
Is there any fixes for that integration or is it just not supported now?16 Replies
Anyone have ever had that problem?
I've created simple GitHub repository to run Deno 2 with Prisma https://github.com/tonidy/prisma-deno-example, currently Prisma is lack off ESM, need a workaround to use CJS in deno
GitHub
GitHub - tonidy/prisma-deno-example
Contribute to tonidy/prisma-deno-example development by creating an account on GitHub.
I kinda forgot to reply here, but the problem persists even with that
--unstable-detect-cjs
flag
I didn't send any messages bc I kinda gave up on prisma with deno, it just doesn't work properlyWorks when you add
You'll now have a
node_modules
, but it prevents Prisma from yelling at you
and in schema.prisma
that's kinda a lot of stuff, how do you know those? I haven't seen any info on that
bc I had to get Prisma working on a project
gonna test it now, sry for taking so long
same thing, it hangs there, it doesn't do anything
That's all I have in the prisma file
deno run -A --allow-scripts --unstable-detect-cjs npm:prisma@latest generate
that was the command I ran--no-engine or whatever the arg is
prisma says nope
I'm starting to think that prisma doesn't like me
wait, it's a miracle, it actually failed now!
maybe you could find another way 😄
last time I tried it, i need to comment
previewFeatures = ["deno"]
. The settings only working with prisma accelerate in this tutorial https://www.prisma.io/docs/orm/prisma-client/deployment/edge/deploy-to-deno-deployDeploy to Deno Deploy | Prisma Documentation
Learn how to deploy a TypeScript application to Deno Deploy.
I had a simlar error to the issue you are having. Try deleteing the
prisma
directories from your node_modules
folder, running npm install
and trying again.
Also...
- Use --unstable-detect-cjs
when running your server.
- Use engineType = "library"
in your Prisma schema.
- Use previewFeatures = ["deno"]
in your Prisma schema.
- When importing your client, use import { type PrismaClient } from "{path-to-generated}/generated/client/index.d.ts";