{"record":{"id":"e82457c7745192a1","repo":"oven-sh/bun","slug":"unsupported-platform-os-arch-abi","errorCode":null,"errorMessage":"Unsupported platform: ${os} ${arch} ${abi || \"\"}","messagePattern":"Unsupported platform: (.+?) (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bun-release/src/npm/install.ts","lineNumber":16,"sourceCode":"import { isAbsolute, relative } from \"path\";\nimport { unzipSync } from \"zlib\";\nimport { debug, error } from \"../console\";\nimport { fetch } from \"../fetch\";\nimport { chmod, join, link, rename, rm, tmp, write } from \"../fs\";\nimport type { Platform } from \"../platform\";\nimport { abi, arch, os, supportedPlatforms } from \"../platform\";\nimport { spawn } from \"../spawn\";\n\ndeclare const version: string;\ndeclare const module: string;\ndeclare const owner: string;\n\nexport async function importBun(): Promise<string> {\n  if (!supportedPlatforms.length) {\n    throw new Error(`Unsupported platform: ${os} ${arch} ${abi || \"\"}`);\n  }\n  for (const platform of supportedPlatforms) {\n    try {\n      return await requireBun(platform);\n    } catch (error) {\n      debug(\"requireBun failed\", error);\n    }\n  }\n  throw new Error(`Failed to install package \"${module}\"`);\n}\n\nasync function requireBun(platform: Platform): Promise<string> {\n  const module = `${owner}/${platform.bin}`;\n  function resolveBun() {\n    const exe = require.resolve(join(module, platform.exe));\n    const { exitCode, stderr, stdout } = spawn(exe, [\"--version\"]);\n    if (exitCode === 0) {\n      return exe;","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/packages/bun-release/src/npm/install.ts#L1-L34","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install bun via the official script instead of the npm package: curl -fsSL https://bun.sh/install | bash (or the PowerShell equivalent)","Use the official Docker image (oven/bun) as the runtime environment","Double-check the platform: 'uname -m', 'node -p process.platform process.arch' — an emulation layer (qemu/Rosetta) may report an unexpected arch","On Alpine ensure the musl pairing matches an entry (x64/aarch64 musl builds exist; other musl archs do not)"],"exampleFix":"# before\nnpm i -g bun   # on linux/armv7l -> \"Unsupported platform: linux arm\"\n\n# after\ncurl -fsSL https://bun.sh/install | bash\n# or run inside: docker run --rm oven/bun -e \"console.log(Bun.version)\"","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set([\n  'darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64',\n  'linux-arm64-musl', 'linux-x64-musl', 'android-arm64', 'android-x64',\n  'freebsd-arm64', 'freebsd-x64', 'win32-x64', 'win32-arm64',\n]);\nconst key = `${process.platform}-${process.arch}`;\nif (!SUPPORTED.has(key)) {\n  throw new Error(`bun npm package unsupported here (${key}); use the install script`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check uname -m and process.arch before adding the bun npm package to CI matrices","Prefer the official install script or oven/bun image on unusual platforms","Do not force npm past its os/cpu warnings (--force) for this package"],"tags":["npm","install","platform","postinstall"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}