Prisma "prisma: command not found" (use npx prisma) in CI
The prisma CLI ships as a local dependency in node_modules/.bin, not a global binary. A bare prisma generate in a shell step cannot find it; running it through npx prisma resolves the local install.
What this error means
A workflow step running prisma generate or prisma migrate deploy fails with "prisma: command not found" and exit code 127, even though prisma is in devDependencies.
/home/runner/work/_temp/script.sh: line 1: prisma: command not found
Error: Process completed with exit code 127.Common causes
The CLI is local, not global
Prisma is installed under node_modules/.bin, which is not on PATH in a plain run step, so the shell cannot locate prisma.
devDependencies were pruned
An install with --omit=dev or NODE_ENV=production skips the Prisma CLI entirely, so no binary exists to call.
How to fix it
Invoke the CLI through npx
npx resolves the local node_modules/.bin/prisma without needing it on PATH.
npx prisma generate
npx prisma migrate deployKeep the CLI installed in CI
- Do not use
--omit=devbefore you need the Prisma CLI. - Install dev dependencies, or add prisma to dependencies if you run it in production images.
- Use
npm exec prismaor an npm script that runs prisma.
{
"scripts": {
"db:generate": "prisma generate"
}
}How to prevent it
- Always call the CLI as
npx prismain workflow steps. - Avoid pruning devDependencies before running Prisma commands.
- Wrap Prisma commands in npm scripts so .bin is on PATH.