Bun "bun: command not found" in CI
The shell could not find a bun executable on PATH. In CI this almost always means the oven-sh/setup-bun step never ran, failed, or a job on a fresh runner is calling Bun before it is installed.
What this error means
A step running bun install or bun run build fails with "bun: command not found" and exit code 127, even though the workflow looks correct.
/home/runner/work/_temp/xxxx.sh: line 1: bun: command not found
Error: Process completed with exit code 127.Common causes
setup-bun never ran before the Bun step
The oven-sh/setup-bun step is missing, is in a different job, or is ordered after the step that calls bun, so nothing put Bun on PATH.
The install step failed silently or PATH was lost
setup-bun failed to download the release, or a later shell/container step does not inherit the PATH entry the action exported.
How to fix it
Add oven-sh/setup-bun before any bun step
- Add the setup-bun action to the same job, before the first
buncall. - Pin a version so downloads are deterministic.
- Verify with a
bun --versionstep immediately after setup.
- uses: oven-sh/setup-bun@v2
with:
bun-version: '1.1.34'
- run: bun --version
- run: bun installInstall Bun directly in a container job
When the job runs inside a container that setup-bun cannot modify, install Bun with the official script and export its bin directory.
- run: |
curl -fsSL https://bun.sh/install | bash
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"How to prevent it
- Keep setup-bun as the first step of every job that uses Bun.
- Pin bun-version so a bad release cannot break the install.
- Add a
bun --versionsmoke step to catch PATH problems early.