Bun "This platform is not supported" (macOS/Linux only) in CI
Bun ships native builds for macOS and Linux. On a Windows runner without a Linux layer, setup-bun cannot install a usable binary, so the job fails before Bun runs.
What this error means
A job on windows-latest fails at the Bun setup or first bun call with a platform/unsupported error, while the same workflow passes on ubuntu-latest.
Error: Unsupported platform: win32
# or, when a script pipe is used:
error: this platform is not supportedCommon causes
A Windows runner without a Linux environment
Bun targets macOS and Linux; a bare windows-latest runner has no native Bun build to install.
A matrix that includes windows for Bun jobs
A cross-OS matrix runs the Bun job on Windows too, where it cannot run natively.
How to fix it
Run Bun jobs on Linux or macOS runners
- Move Bun jobs to
ubuntu-latestormacos-latest. - Exclude Windows from the Bun matrix if you keep a cross-OS matrix.
- Use setup-bun on those runners as normal.
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: oven-sh/setup-bun@v2Use WSL when Windows is required
If you must run on Windows, execute Bun inside a WSL/Linux context rather than the native Windows shell.
How to prevent it
- Target Linux or macOS runners for Bun jobs.
- Exclude windows from any Bun matrix leg.
- Document that Bun native builds are macOS/Linux only.