oven-sh/bun · error · Error

Unsupported platform: ${os} ${arch} ${abi || ""}

Error message

Unsupported platform: ${os} ${arch} ${abi || ""}

What it means

The postinstall of the npm-distributed bun package computes supportedPlatforms from process.platform, process.arch (with Rosetta 2 translation), and an abi marker (musl on Alpine, android). If that triple matches none of the published binaries, importBun() refuses to continue and reports the exact triple. Only non-alias entries are eligible (baseline variants are back-compat aliases, skipped here).

Source

Thrown at packages/bun-release/src/npm/install.ts:16

import { isAbsolute, relative } from "path";
import { unzipSync } from "zlib";
import { debug, error } from "../console";
import { fetch } from "../fetch";
import { chmod, join, link, rename, rm, tmp, write } from "../fs";
import type { Platform } from "../platform";
import { abi, arch, os, supportedPlatforms } from "../platform";
import { spawn } from "../spawn";

declare const version: string;
declare const module: string;
declare const owner: string;

export async function importBun(): Promise<string> {
  if (!supportedPlatforms.length) {
    throw new Error(`Unsupported platform: ${os} ${arch} ${abi || ""}`);
  }
  for (const platform of supportedPlatforms) {
    try {
      return await requireBun(platform);
    } catch (error) {
      debug("requireBun failed", error);
    }
  }
  throw new Error(`Failed to install package "${module}"`);
}

async function requireBun(platform: Platform): Promise<string> {
  const module = `${owner}/${platform.bin}`;
  function resolveBun() {
    const exe = require.resolve(join(module, platform.exe));
    const { exitCode, stderr, stdout } = spawn(exe, ["--version"]);
    if (exitCode === 0) {
      return exe;

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Install bun via the official script instead of the npm package: curl -fsSL https://bun.sh/install | bash (or the PowerShell equivalent)
  2. Use the official Docker image (oven/bun) as the runtime environment
  3. Double-check the platform: 'uname -m', 'node -p process.platform process.arch' — an emulation layer (qemu/Rosetta) may report an unexpected arch
  4. On Alpine ensure the musl pairing matches an entry (x64/aarch64 musl builds exist; other musl archs do not)

Example fix

# before
npm i -g bun   # on linux/armv7l -> "Unsupported platform: linux arm"

# after
curl -fsSL https://bun.sh/install | bash
# or run inside: docker run --rm oven/bun -e "console.log(Bun.version)"
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set([
  'darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64',
  'linux-arm64-musl', 'linux-x64-musl', 'android-arm64', 'android-x64',
  'freebsd-arm64', 'freebsd-x64', 'win32-x64', 'win32-arm64',
]);
const key = `${process.platform}-${process.arch}`;
if (!SUPPORTED.has(key)) {
  throw new Error(`bun npm package unsupported here (${key}); use the install script`);
}

Prevention

When it happens

Trigger: Installing the bun npm package on linux + arm (armv7l), riscv64, ppc64le, s390x, openbsd/netbsd, or any (os, arch, abi) combination absent from the platform table; also abi mismatches such as darwin or freebsd with a musl-style detection result.

Common situations: Running npm install on exotic boards (Raspberry Pi 32-bit OS), unusual containers, or CI images whose arch does not match a published bun binary; forcing the install past npm's os/cpu checks with --force.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/e82457c7745192a1. Report an issue: GitHub.