Skip to content
Latchkey

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

  1. Add pnpm/action-setup before actions/setup-node.
  2. Set the version, or omit it to use the packageManager field.
  3. 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-lockfile

Or 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-lockfile

How to prevent it

  • Provision pnpm (action-setup or corepack) before any pnpm step.
  • Order pnpm setup before setup-node with cache: pnpm.
  • Pin the pnpm version via packageManager so all steps agree.

Related guides

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