Skip to content
Latchkey

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.

Prisma
/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.

Terminal
npx prisma generate
npx prisma migrate deploy

Keep the CLI installed in CI

  1. Do not use --omit=dev before you need the Prisma CLI.
  2. Install dev dependencies, or add prisma to dependencies if you run it in production images.
  3. Use npm exec prisma or an npm script that runs prisma.
package.json
{
  "scripts": {
    "db:generate": "prisma generate"
  }
}

How to prevent it

  • Always call the CLI as npx prisma in workflow steps.
  • Avoid pruning devDependencies before running Prisma commands.
  • Wrap Prisma commands in npm scripts so .bin is on PATH.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →