Next.js Discord

Discord Forum

npm ERR! command sh -c prisma generate

Answered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
"scripts": {
"dev": "next dev",
"build": "prisma generate && next build",
"start": "next start",
"lint": "next lint",
"postinstall": "prisma generate"
},

my model
model JobPosting {
id String @id @default(uuid()) @map("_id")
title String
description jobsDescription[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
applications Application[]
requirements Requirement[]
prerequisites Prerequisite[]
intern Boolean @default(false)
status Boolean @default(true)
}

model jobsDescription {
id String @id @default(uuid())
description String
jobPostingId String
jobPosting JobPosting @relation(fields: [jobPostingId], references: [id])
}

model Prerequisite {
id String @id @default(uuid())
prerequisite String
jobPostingId String
jobPosting JobPosting @relation(fields: [jobPostingId], references: [id])
}

model Requirement {
id String @id @default(uuid())
requirement String
jobPostingId String
jobPosting JobPosting @relation(fields: [jobPostingId], references: [id])
}

model Application {
id String @id @default(uuid()) @map("_id")
jobId String
name String
surname String
phoneNumber String
email String
coverLetter String
resumeUrl String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
jobPosting JobPosting @relation(fields: [jobId], references: [id], onDelete: Cascade)
status Boolean @default(false)
}
Answered by Bighead carp
Try removing prisma generate from your build
View full answer

31 Replies

Cape lionOP
sh: prisma: command not found
npm ERR! code 127
npm ERR! path /vercel/path0
npm ERR! command failed
npm ERR! command sh -c prisma generate
npm ERR! A complete log of this run can be found in: /vercel/.npm/_logs/2024-02-06T11_33_23_939Z-debug-0.log
Error: Command "npm install" exited with 127

vercel error logs
Cape lionOP
it works when I redo the download in my local, what exactly is the problem?
if you remove the postinstall script does it work?
@riský if you remove the postinstall script does it work?
Cape lionOP
one sec i will try
thx btw
Answer
thats not where the error was (see the "npm install")
Bighead carp
Nowhere in his scripts does he use npm install
remember they are using vercel
Bighead carp
Sure but that wouldn't have anything to do with what I said
The reason I suggest this, is that I don't have that step in my build
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "format": "prettier --check .",
    "format:fix": "prettier --write --list-different .",
    "cypress:open": "cypress open",
    "postinstall": "prisma generate && prisma migrate deploy",
    "test": "jest",
    "test:watch": "jest --watch"
  },
https://www.prisma.io/docs/orm/prisma-client/deployment/serverless/deploy-to-vercel You'll notice here that the prisma generate is ran in postinstall, not build
well i just wanted them to only have it once (also fwiw i use prisma in build not postinstall), i was after that going to check if they actually have prisma in deps
Bighead carp
If you see prisma: command not found errors during your deployment to Vercel, you are missing prisma in your dependencies. By default, prisma is a dev dependency and may need to be moved to be a standard dependency.
You're right. This is from that link I just sent
@Cape lion
but i also have had too many issues from postinstall not having scope yet, so i just dont use when i don't need to
and it feels better to be in build anyway (as your building the prisma)
Bighead carp
By default it is in dev deps
hmm i guess dev is only meant to developing and not prod build
ig im glad i only have @types there
Bighead carp
How do you not have prisma installed?
I'm confused
who are you talking to?
Bighead carp
You lol
i have prisma in main deps
Bighead carp
Oh understood
@Cape lion If you could mark the solution that would be great