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.
$ 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.
npm install -D prettier
npx prettier --check . # or: npm run format:checkKeep dev dependencies for the format step
- Do not pass
--omit=dev/--productionto the install before formatting. - Define a
"format:check": "prettier --check ."npm script. - Use
npm ci(with dev deps) so the binary is present.
How to prevent it
- Declare Prettier in
devDependenciesand run it via an npm script ornpx. - Keep dev dependencies installed for the format step in CI.
- Never rely on a global Prettier install in CI.