{"record":{"id":"a60597b1fbb57e0e","repo":"JuliusBrussee/caveman","slug":"no-prebuilt-binary-for-os-arch-supported-a60597","errorCode":null,"errorMessage":"no prebuilt binary for ${os}/${arch} — supported: darwin/arm64, darwin/amd64, linux/arm64, linux/amd64, win32/arm64, win32/amd64","messagePattern":"no prebuilt binary for (.+?)/(.+?) — supported: darwin/arm64, darwin/amd64, linux/arm64, linux/amd64, win32/arm64, win32/amd64","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/binary-installer/installer.mjs","lineNumber":69,"sourceCode":"}\n\nfunction onPath(name) {\n  if (isAbsolute(name) || /[\\\\/]/.test(name)) return executable(name) ? name : null;\n  for (const dir of (process.env.PATH ?? \"\").split(delimiter)) {\n    if (!dir) continue;\n    for (const candidate of executableCandidateNames(name)) {\n      const path = join(dir, candidate);\n      if (executable(path)) return path;\n    }\n  }\n  return null;\n}\n\nexport function targetPlatform(os = process.platform, nodeArch = process.arch) {\n  const arch = nodeArch === \"x64\" ? \"amd64\" : nodeArch;\n  if (!(os === \"darwin\" || os === \"linux\" || os === \"win32\") ||\n      !(arch === \"arm64\" || arch === \"amd64\")) {\n    throw new Error(`no prebuilt binary for ${os}/${arch} — supported: darwin/arm64, darwin/amd64, linux/arm64, linux/amd64, win32/arm64, win32/amd64`);\n  }\n  return { os, arch };\n}\n\nexport function binaryInstallFilename(name, os = process.platform) {\n  return os === \"win32\" ? `${name}.exe` : name;\n}\n\nfunction timeoutMs() {\n  const raw = process.env.CAVE_SETUP_TIMEOUT ?? \"300\";\n  const seconds = Number(raw);\n  if (!Number.isInteger(seconds) || seconds <= 0) {\n    throw new Error(`CAVE_SETUP_TIMEOUT must be a positive integer (got ${JSON.stringify(raw)})`);\n  }\n  return seconds * 1000;\n}\n\nasync function asset(url, timeout) {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/binary-installer/installer.mjs#L51-L87","documentation":"`targetPlatform` maps process.platform/process.arch to a supported prebuilt-binary platform triple. It throws when the combination is not one of the six supported pairs (darwin/linux/win32 × arm64/amd64), because the installer cannot download a binary for that target.","triggerScenarios":"Running the installer on an unsupported OS (e.g. freebsd, openbsd, sunos) or unsupported architecture (e.g. ia32, armv7l, ppc64, s390x, mips).","commonSituations":"CI runner on a 32-bit Node (x64→amd64 works but ia32 stays ia32); Raspberry Pi on 32-bit ARM (arm); Alpine/FreeBSD container; exotic arch in a QEMU-emulated build job.","solutions":["Run on a supported platform: darwin/linux/win32 with arm64 or x64 (amd64) Node","Use a 64-bit Node build (node -p process.arch should print arm64 or x64)","On 32-bit ARM Linux, switch to a 64-bit OS image or an amd64 emulator/container","Build the binary from source and install it manually if no prebuilt exists for your target"],"exampleFix":"// before (32-bit ARM board)\n$ node -p process.arch\narm\n// after: use 64-bit Node/OS\n$ node -p process.arch\narm64","handlingStrategy":"type-guard","validationCode":"const SUPPORTED = new Set([\"darwin\",\"linux\",\"win32\"]);\nconst ARCHS = new Set([\"arm64\",\"amd64\"]);\nconst arch = process.arch === \"x64\" ? \"amd64\" : process.arch;\nif (!SUPPORTED.has(process.platform) || !ARCHS.has(arch)) {\n  throw new Error(`unsupported target ${process.platform}/${process.arch}; use a supported runner`);\n}","typeGuard":"const isSupportedTarget = (os, nodeArch) =>\n  [\"darwin\",\"linux\",\"win32\"].includes(os) &&\n  [\"arm64\",\"amd64\"].includes(nodeArch === \"x64\" ? \"amd64\" : nodeArch);","tryCatchPattern":"try {\n  const { os, arch } = targetPlatform();\n  await installBinary(os, arch);\n} catch (e) {\n  if (String(e.message).startsWith(\"no prebuilt binary for\")) {\n    console.error(\"Run on darwin/linux/win32 (arm64/x64) or build the binary from source\");\n    process.exitCode = 1;\n  } else throw e;\n}","preventionTips":["Check process.platform/process.arch in setup scripts before installing","Use 64-bit Node images in CI (never ia32 or 32-bit arm images)","Add a matrix guard so unsupported runners skip the install step","For exotic targets, pre-build the binary and vendor it"],"tags":["platform","installer","prebuilt"],"backgroundTag":"unsupported-platform","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}