denoland/deno · error

Unsupported platform: {} {}

Error message

Unsupported platform: {} {}

What it means

Panic in cli/tools/bundle/esbuild.rs. The `deno bundle` command downloads a platform-specific esbuild binary (an npm package like @esbuild/linux-x64) chosen from a fixed table of arch/OS pairs. Only x86_64/aarch64 on linux, macOS (darwin), windows, and android are mapped; any other combination (e.g. riscv64, i686, freebsd, 32-bit arm) hits the wildcard arm and panics with the detected arch and OS.

Source

Thrown at cli/tools/bundle/esbuild.rs:36

use crate::npm::CliNpmRegistryInfoProvider;
use crate::sys::CliSys;

pub const ESBUILD_VERSION: &str = "0.25.5";
// Bump when helper acquisition semantics change so an existing executable is
// reacquired under the new rules.
const ESBUILD_CACHE_VERSION: u8 = 1;

fn esbuild_platform() -> &'static str {
  match (std::env::consts::ARCH, std::env::consts::OS) {
    ("x86_64", "linux") => "linux-x64",
    ("aarch64", "linux") => "linux-arm64",
    ("x86_64", "macos" | "apple") => "darwin-x64",
    ("aarch64", "macos" | "apple") => "darwin-arm64",
    ("x86_64", "windows") => "win32-x64",
    ("aarch64", "windows") => "win32-arm64",
    ("x86_64", "android") => "android-x64",
    ("aarch64", "android") => "android-arm64",
    _ => panic!(
      "Unsupported platform: {} {}",
      std::env::consts::ARCH,
      std::env::consts::OS
    ),
  }
}

pub async fn ensure_esbuild(
  deno_dir: &DenoDir,
  npmrc: &ResolvedNpmRc,
  api: &Arc<CliNpmRegistryInfoProvider>,
  workspace_link_packages: &WorkspaceNpmLinkPackagesRc,
  tarball_cache: &Arc<TarballCache<CliNpmCacheHttpClient, CliSys>>,
  npm_cache: &CliNpmCache,
) -> Result<PathBuf, AnyError> {
  let target = esbuild_platform();
  let mut esbuild_path = deno_dir
    .dl_folder_path()

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Run `deno bundle` on a supported platform (x64 or arm64 linux/macOS/Windows) or cross-bundle from there
  2. Bundle with esbuild directly on the exotic host (install esbuild built for it, feed it Deno-resolved inputs)
  3. Pre-bundle as a build step on a supported CI runner and ship the artifact

Example fix

# before (on riscv64 host)
deno bundle main.ts              # panic: Unsupported platform: riscv64 linux
# after (on supported runner)
deno bundle main.ts --out dist/bundle.js   # then deploy dist/
Defensive patterns

Strategy: validation

Validate before calling

// run before invoking the bundler in tooling
const supported = new Set([
  'x86_64-linux','aarch64-linux','x86_64-darwin','aarch64-darwin',
  'x86_64-windows','aarch64-windows','x86_64-android','aarch64-android',
]);
const key = `${Deno.build.arch}-${Deno.build.os}`;
if (!supported.has(key)) {
  throw new Error(`deno bundle unsupported on ${key}; bundle on x64/arm64 linux/mac/win`);
}

Type guard

const isEsbuildSupportedPlatform = (): boolean =>
  ['x86_64', 'aarch64'].includes(Deno.build.arch) &&
  ['linux', 'darwin', 'windows', 'android'].includes(Deno.build.os);

Prevention

When it happens

Trigger: Running `deno bundle` on an unsupported platform, e.g. Debian riscv64, i686-linux, armv7, FreeBSD, or OpenBSD — any (ARCH, OS) outside the eight mapped esbuild target tuples.

Common situations: Users on niche/embedded architectures or BSD systems trying the bundler; containers with exotic base images (e.g. i386); CI on non-x64/arm runners.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/ea81bf9e19f640e5. Report an issue: GitHub.