pnpm "command not found" on the runner in CI
GitHub-hosted runners do not have pnpm on PATH by default. A pnpm install step run before pnpm is provisioned dies with "command not found" and exit code 127.
What this error means
A workflow step fails with "pnpm: command not found" and "Process completed with exit code 127", usually because setup-node ran without pnpm being enabled first.
/home/runner/work/_temp/script.sh: line 1: pnpm: command not found
Error: Process completed with exit code 127.Common causes
pnpm was never installed on the runner
The workflow calls pnpm before enabling corepack or running pnpm/action-setup, so no pnpm binary is on PATH.
setup-node cache: pnpm ran before pnpm existed
Ordering actions/setup-node with cache: pnpm before pnpm is enabled fails because the cache step itself needs pnpm on PATH.
How to fix it
Enable pnpm with pnpm/action-setup
- Add
pnpm/action-setupbeforeactions/setup-node. - Set the version, or omit it to use the
packageManagerfield. - Then run setup-node with
cache: pnpm.
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfileOr enable corepack
Corepack ships with Node and can activate the pnpm version pinned in packageManager without a separate action.
- run: corepack enable
- run: pnpm install --frozen-lockfileHow to prevent it
- Provision pnpm (action-setup or corepack) before any pnpm step.
- Order pnpm setup before
setup-nodewithcache: pnpm. - Pin the pnpm version via
packageManagerso all steps agree.