prisma-kysely icon indicating copy to clipboard operation
prisma-kysely copied to clipboard

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

Open Muhammad-Arsalan31 opened this issue 2 years ago • 8 comments
trafficstars

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?

Muhammad-Arsalan31 avatar Aug 22 '23 14:08 Muhammad-Arsalan31

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 🫡

valtyr avatar Aug 22 '23 23:08 valtyr

Thanks, yes I am on Windows.

Muhammad-Arsalan31 avatar Aug 23 '23 06:08 Muhammad-Arsalan31

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

dylel avatar Aug 26 '23 22:08 dylel

Postgres

Muhammad-Arsalan31 avatar Aug 26 '23 22:08 Muhammad-Arsalan31

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

dylel avatar Sep 02 '23 06:09 dylel

Hi, any updates on this issue?

Muhammad-Arsalan31 avatar Oct 16 '23 12:10 Muhammad-Arsalan31

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

drew-marsh avatar Nov 21 '23 05:11 drew-marsh

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.

MrSharpp avatar Dec 24 '23 12:12 MrSharpp