valtyr/prisma-kysely

Prisma kysely not generating, Error: spawn prisma-kysely ENOENT

Opened this issue · 8 comments

Hi, I am having trouble generating types

this is my schema file I want to build both Prisma and Kysely types.

generator client {
  provider = "prisma-client-js"
}

generator kysely {
  provider = "prisma-kysely"

  // Optionally provide a destination directory for the generated file
  // and a filename of your choice
  output       = "../src/db"
  fileName     = "types.ts"
  // Optionally generate runtime enums to a separate file
  enumFileName = "enums.ts"
}

I am using Prisma 5 and prisma-kysely version 1.6

this is the error
image

what am I doing wrong?

valtyr commented

Huh this is interesting. This is likely related to #63. Might be related to you using Windows. I haven't done any testing on non-UNIX systems, and my assumption is that prisma-kysely is doing something wrong when it comes to paths. I'll fire up my Windows system soon and have a look. Thank you for reporting 🫡

Thanks, yes I am on Windows.

dylel commented

@Muhammad-Arsalan31 what database provider are you using? MySql?

Postgres

dylel commented

I've had this happen to me a few times when the module wasn't actually installed correctly for whatever reason, removing prisma-kysely, remove node modules, install node modules, install prisma-kysely. This generally fixes it for me

Hi, any updates on this issue?

a global prisma-kysely install fixed this for me
npm i -g prisma-kysely

found a fix for this issue,
this issue was arising due to importing of es6 module "string-width" into prisma-kysely dist files.
the quickest solution for me is to just remove all node_modules and then instead of using yarn i used pnpm and it installed correct peer dependency which somehow worked with prisma-kysely.