'ts-node' is not recognized

I understand that this error comes from that ts-node is not installed globally . I want to report that in the seeding guide, there is written " Add typescript, ts-node and @types/node development dependencies: " npm install -D typescript ts-node @types/node and
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
},
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
},
but this wont work, because we are isntalling ts-node locally and not globally
6 Replies
Prisma AI Help
You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.
RaphaelEtim
RaphaelEtim2d ago
Hi @bockster6669 If you run the command below with your seed script defined like you mentioned, it would work.
npx prisma db seed
npx prisma db seed
RaphaelEtim
RaphaelEtim2d ago
No description
bockster6669
bockster6669OP2d ago
You mean, if I install ts-node globally? I fix the issue by placing npx before ts-node
RaphaelEtim
RaphaelEtim2d ago
You mean, if I install ts-node globally?
No, you don't need to install ts-node globally this is how i defined my script
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
}
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
}
Then running the command executes it ` npx prisma db seed
bockster6669
bockster6669OP2d ago
But this is the problem I am reporting, this is not going to work, because ts-node is not recognised as a command

Did you find this page helpful?