CarterGrimmeisen / zod-prisma

A custom prisma generator that creates Zod schemas from your Prisma model.
MIT License
825 stars 86 forks source link

/bin/sh: 1: zod-prisma: not found #19

Closed kenneho closed 2 years ago

kenneho commented 3 years ago

Hi. I'm trying to get this great library to work in a (Blitzjs with) Prisma project, but don't seem to get it installed properly. Steps:

me@computer:~/project$ npm i --save-dev zod-prisma

added 10 packages, and audited 1714 packages in 12s

Add this to schema.prisma:

generator zod {
  provider      = "zod-prisma"
  output        = "./zod"
  relationModel = "default"
}

Run blitz prisma migrate dev, which results in this error:

Environment variables loaded from .env
Prisma schema loaded from db/schema.prisma
Datasource "db": SQLite database "db.sqlite" at "file:./db.sqlite"

Already in sync, no schema change or pending migration was found.

Running generate... (Use --skip-generate to skip the generators)
Error: Generator at zod-prisma could not start:

/bin/sh: 1: zod-prisma: not found

To me I loks like zod-prisma haven't been properly installed, and I suspect must have missed something in the documentation have yet to find exactly what. Do you have any suggestions as to how to debug this? In the mean while I'm going for node_modules/zod-prisma/bin/cli.js as the provider.

CarterGrimmeisen commented 2 years ago

Hey there!

It looks like it was a configuration issue on my end that I didn't spot at first because of the version of yarn I was using. I've updated the bin entry in package.json to use the correct format, among some other small changes and published the update.

Thanks for pointing out the issue and let me know if this doesn't resolve the problem for you.

kenneho commented 2 years ago

Thanks, I ran the updated version, and it works perfectly.