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.
pnpm
/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.
.github/workflows/ci.yml
- 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.
.github/workflows/ci.yml
- 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.
Related guides
pnpm "packageManager" version mismatch with corepack in CIFix corepack "This project is configured to use pnpm because of a packageManager field" mismatch in CI - the…
pnpm store not cached (slow install every run) in CIFix slow pnpm installs in CI caused by an uncached content-addressable store - without caching ~/.pnpm-store…
Yarn "Usage Error" / wrong version from corepack in CIFix Yarn "Usage Error" and "command not found" from corepack version mismatches in CI - the packageManager fi…