Error: spawn prisma-class-generator ENOENT
PAHJunior opened this issue · 8 comments
file schema.prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator prismaClassGenerator {
provider = "prisma-class-generator"
}
model Company {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String @unique
cnpj String @unique
status EnumStatus @default(ACTIVE)
phone String?
Products Products[]
}
model Products {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
productName String
company Company @relation(fields: [companyId], references: [id])
status EnumStatus @default(ACTIVE)
companyId Int
@@unique([productName, companyId], name: "productName_companyId_unique_constraint")
}
enum EnumStatus {
ACTIVE
INACTIVE
}
Steps to Reproduce the Problem
- Run the
prisma generate
- Error
Error: spawn prisma-class-generator ENOENT
Specifications
- Version: 0.1.10
- Prisma Version: 3.3.0
- Platform: Windows
�Hello, PAHJunior
Would you like to install this library except for the "--dev" flag?
like this, https://github.com/kimjbstar/prisma-class-generator-example
Hello, @kimjbstar ,
Yes I installed using --dev.
I just cloned the example you sent and it gives the same error
prisma -v
prisma : 3.3.0
@prisma/client : 3.5.0
Current platform : windows
Query Engine (Node-API) : libquery-engine 33838b0f78f1fe9052cf9a00e9761c9dc097a63c (at ..\..\..\..\AppData\Roaming\npm\node_modules\prisma\node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine : migration-engine-cli 33838b0f78f1fe9052cf9a00e9761c9dc097a63c (at ..\..\..\..\AppData\Roaming\npm\node_modules\prisma\node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 33838b0f78f1fe9052cf9a00e9761c9dc097a63c (at ..\..\..\..\AppData\Roaming\npm\node_modules\prisma\node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary : prisma-fmt 33838b0f78f1fe9052cf9a00e9761c9dc097a63c (at ..\..\..\..\AppData\Roaming\npm\node_modules\prisma\node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 33838b0f78f1fe9052cf9a00e9761c9dc097a63c
Studio : 0.437.0
Regardless if I use my own project or the sample project from @kimjbstar , I get the ENOENT error.
@PAHJunior How you solve this?
Hmm, sorry, i don't remember.
I should have put the solution here before closing, sorry
I saw this issue while using the below generator (Not related to this repo, but this the only place I found talking about this issue)
generator client {
provider = "prisma-kysely"
output = "../src/lib/db"
fileName = "schema.d.ts"
}
I solved the issue by installing prisma-kysely using the -g argument:
npm install -g prisma-kysely
So maybe if you use this code?
npm install -g prisma-class-generator
If this isn't helpful, please delete this comment.
@PAHJunior How you solve this?
The problem solved after re-install prisma-class-generator