{"record":{"id":"03940046709103e1","repo":"evanw/esbuild","slug":"unsupported-platform-platformkey","errorCode":null,"errorMessage":"Unsupported platform: ${platformKey}","messagePattern":"Unsupported platform: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/npm/node-platform.ts","lineNumber":80,"sourceCode":"\n  if (platformKey in knownWindowsPackages) {\n    pkg = knownWindowsPackages[platformKey]\n    subpath = 'esbuild.exe'\n  }\n\n  else if (platformKey in knownUnixlikePackages) {\n    pkg = knownUnixlikePackages[platformKey]\n    subpath = 'bin/esbuild'\n  }\n\n  else if (platformKey in knownWebAssemblyFallbackPackages) {\n    pkg = knownWebAssemblyFallbackPackages[platformKey]\n    subpath = 'bin/esbuild'\n    isWASM = true\n  }\n\n  else {\n    throw new Error(`Unsupported platform: ${platformKey}`)\n  }\n\n  return { pkg, subpath, isWASM }\n}\n\nfunction pkgForSomeOtherPlatform(): string | null {\n  const libMainJS = require.resolve('esbuild')\n  const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)))\n\n  if (path.basename(nodeModulesDirectory) === 'node_modules') {\n    for (const unixKey in knownUnixlikePackages) {\n      try {\n        const pkg = knownUnixlikePackages[unixKey]\n        if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg\n      } catch {\n      }\n    }\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/evanw/esbuild/blob/f6058f8364fe7ab91ca57a83e02577ed74c9cae4/lib/npm/node-platform.ts#L62-L98","documentation":"pkgAndSubpathForCurrentPlatform (lib/npm/node-platform.ts:57) builds a platformKey from `${process.platform} ${os.arch()} ${os.endianness()}` and looks it up in knownWindowsPackages, knownUnixlikePackages, then knownWebAssemblyFallbackPackages. If it matches none, esbuild has no prebuilt binary for that OS/arch/endianness combination and throws. This is an environment esbuild simply does not ship a native binary for.","triggerScenarios":"Running esbuild (install or at runtime via generateBinPath) on an OS/architecture combination for which esbuild publishes no platform package.","commonSituations":"Niche or new CPU architectures (rare RISC boards); an OS esbuild doesn't target; unusual endianness; a custom Node build reporting an exotic platform string.","solutions":["Use the esbuild-wasm package, which is platform-independent.","Build esbuild from source for your platform (it is written in Go).","Run your build inside a container/VM with a supported platform.","Open an issue / contribute a platform package if demand justifies it."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Detect an unsupported platform up front and choose esbuild-wasm.\nconst os = require('os')\nconst known = require('./known-platforms.json') // mirror esbuild's package maps\nconst key = `${process.platform} ${os.arch()} ${os.endianness()}`\nif (!known.includes(key)) {\n  console.warn('Unsupported native platform; use esbuild-wasm')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["On exotic architectures, depend on esbuild-wasm rather than native esbuild.","Run builds in a container with a supported platform if native speed is required.","Check esbuild's supported platform list before committing to an unusual CI runner."],"tags":["platform","install","architecture","native-binary"],"backgroundTag":null,"analyzedSha":"f6058f8364fe7ab91ca57a83e02577ed74c9cae4","analyzedAt":"2026-08-09T18:37:22.223Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}