Skip to content
Latchkey

CI "prettier: command not found" - Fix Missing Prettier Binary

The shell could not find a prettier executable. Prettier is not installed in the project, dev dependencies were pruned, or the step invoked a bare prettier that only resolves to a global install CI does not have.

What this error means

The format step fails with prettier: command not found and exit code 127. The same command works locally where Prettier is on PATH or installed.

shell
$ prettier --check .
/bin/sh: 1: prettier: command not found
Error: Process completed with exit code 127.

Common causes

Prettier not installed or dev deps pruned

Prettier is missing from devDependencies, or the install ran with --omit=dev/--production, so the binary is absent in CI.

Calling a bare global prettier

The step runs prettier directly, relying on a global install. CI has no global Prettier, so it must use the local binary via npx/an npm script.

How to fix it

Install Prettier and call it locally

Add Prettier as a dev dependency and invoke the project-local binary.

Terminal
npm install -D prettier
npx prettier --check .   # or: npm run format:check

Keep dev dependencies for the format step

  1. Do not pass --omit=dev/--production to the install before formatting.
  2. Define a "format:check": "prettier --check ." npm script.
  3. Use npm ci (with dev deps) so the binary is present.

How to prevent it

  • Declare Prettier in devDependencies and run it via an npm script or npx.
  • Keep dev dependencies installed for the format step in CI.
  • Never rely on a global Prettier install in CI.

Frequently asked questions

What causes ""prettier: command not found""?
Prettier is missing from devDependencies, or the install ran with --omit=dev/--production, so the binary is absent in CI.
How do I fix "prettier: command not found"?
Add Prettier as a dev dependency and invoke the project-local binary.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card