Skip to content

Process Completed With Exit Code 127: Command Not Found

Last updated

Process completed with exit code 127 means the shell could not find the command it was asked to run. Look a few lines above it for command not found or No such file or directory. The causes are a tool that is not installed on the runner, a PATH that does not include it, a script path that is wrong, or a script file with Windows line endings.

The exact message

/home/runner/work/_temp/abc123.sh: line 1: pnpm: command not found
Error: Process completed with exit code 127.
./deploy.sh: No such file or directory
Error: Process completed with exit code 127.

Cause 1: the tool is not installed on the runner

Hosted images include many tools, and not all. Check the runner images software list for your runs-on label, and install what is missing with a setup action or a package manager:

- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
  with:
    node-version: 22
    cache: pnpm
- run: pnpm install --frozen-lockfile

For system packages on Ubuntu:

- run: sudo apt-get update && sudo apt-get install -y jq

If you moved from ubuntu-latest to a self-hosted or third-party runner, the image may be missing tools that GitHub's image has. Compare before you switch.

Cause 2: it is installed but not on PATH

A tool installed in one step is not on PATH in the next unless you add its directory to the GITHUB_PATH file. Do not use export PATH=... for this, because that only affects the current step:

- run: |
    curl -fsSL https://example.com/tool.tar.gz | tar xz -C "$HOME/tool"
    echo "$HOME/tool/bin" >> "$GITHUB_PATH"
- run: tool --version

Cause 3: wrong script path or missing execute bit

./script.sh: No such file or directory and Permission denied mean the path is wrong relative to the working directory, or the file is not executable. Check working-directory, and make the file executable in git:

chmod +x scripts/deploy.sh
git update-index --chmod=+x scripts/deploy.sh

Or call it through the interpreter, which does not need the execute bit: run: bash scripts/deploy.sh.

Cause 4: Windows line endings (CRLF)

A script saved with CRLF line endings has a hidden carriage return in its shebang line, so the system looks for an interpreter named bash\r, and reports "No such file or directory" even though the file exists. Convert it:

sed -i 's/\r$//' scripts/deploy.sh

and stop it coming back with a .gitattributes file:

*.sh text eol=lf

Cause 5: a typo or a wrong shell

Command names are case sensitive on Linux. A step with shell: pwsh runs PowerShell, which has different commands from bash, and a shell: cmd step cannot run bash syntax.

Cause 6: a missing binary inside a container job

When a job runs container:, tools come from that image, not from the runner. Use an image that includes what you need.

How to prevent it

  1. Print versions at the start of the job (node --version, docker --version) so a missing tool fails fast and clearly.
  2. Install tools with pinned setup actions rather than assuming they are present.
  3. Keep scripts executable and LF-terminated through .gitattributes.
  4. Run the same step in a clean container locally to catch assumptions about your machine.

FAQ

What does exit code 127 mean?

"Command not found" in POSIX shells. It is returned when the shell cannot find or execute the program.

Why does the command work on my machine?

Your machine has the tool installed and on PATH. A runner is clean and starts each step in a new shell.

What is the difference between 126 and 127?

126 means the file was found but could not be executed, often because of permissions. 127 means it was not found at all.

Does the setup differ on Windows and macOS runners?

Yes. Tool lists differ between images, so check the software list for the label you use.