denoland/deno · error · anyhow::Error

Unsupported platform for the native TypeScript compiler: {ar

Error message

Unsupported platform for the native TypeScript compiler: {arch} {os}

What it means

The native (Go) TypeScript compiler is only published for the six arch/OS pairs in the match table (x86_64/aarch64 × linux/macos/windows). Any other host fails platform resolution before a download is attempted, so `deno check` via the native path cannot run there.

Source

Thrown at cli/tsc/native.rs:62

fn typescript_platform() -> Result<&'static str, AnyError> {
  typescript_platform_for(std::env::consts::ARCH, std::env::consts::OS)
}

/// Map a Rust `(ARCH, OS)` pair (as in [`std::env::consts`]) to the
/// `@typescript/typescript-<suffix>` package suffix. Split out so the mapping
/// can be unit-tested for every supported host.
fn typescript_platform_for(
  arch: &str,
  os: &str,
) -> Result<&'static str, AnyError> {
  Ok(match (arch, os) {
    ("x86_64", "linux") => "linux-x64",
    ("aarch64", "linux") => "linux-arm64",
    ("x86_64", "macos") => "darwin-x64",
    ("aarch64", "macos") => "darwin-arm64",
    ("x86_64", "windows") => "win32-x64",
    ("aarch64", "windows") => "win32-arm64",
    _ => anyhow::bail!(
      "Unsupported platform for the native TypeScript compiler: {arch} {os}"
    ),
  })
}

/// Ensure the pinned native `tsc` for the host platform is available and
/// return the path to the executable, downloading the
/// `@typescript/typescript-<platform>` npm package if it isn't cached yet.
///
/// This deliberately fetches only the single host-platform package rather than
/// resolving `typescript` itself (whose optional dependencies would pull every
/// platform binary), mirroring how [`crate::tools::bundle::esbuild`] obtains
/// esbuild. Unlike esbuild (a single standalone binary), the tsc binary lives
/// in a `lib/` directory next to the default `lib.*.d.ts` files it loads at
/// runtime, so the whole `lib/` tree is materialized alongside it.
pub async fn ensure_native_tsc(
  deno_dir: &DenoDir,
  npmrc: &ResolvedNpmRc,

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Set DENO_TSC_BIN to an existing tsc binary you built or obtained — deno uses it directly and skips platform resolution and download
  2. Run deno on a supported host (x86_64 or aarch64 on linux, macos, or windows)
  3. When building deno from source for the platform, cross-compile or provide the compiler via DENO_TSC_BIN

Example fix

# before
deno check mod.ts   # on e.g. armv7 linux
# after
export DENO_TSC_BIN=/usr/local/bin/tsc
deno check mod.ts
Defensive patterns

Strategy: fallback

Validate before calling

# provision a compiler binary before running deno on an unsupported host
export DENO_TSC_BIN=/opt/tsc/tsc
[ -x "$DENO_TSC_BIN" ] || { echo "DENO_TSC_BIN not executable" >&2; exit 1; }
deno check mod.ts

Prevention

When it happens

Trigger: Running a deno build that routes through cli/tsc/native.rs on a host where `std::env::consts::(ARCH, OS)` is not in the table — e.g. armv7/i686 linux, freebsd, riscv64.

Common situations: 32-bit or niche-architecture Linux/BSD machines; experimental platforms before @typescript/typescript-<platform> packages exist for them.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/f52cbd1e527cc79d. Report an issue: GitHub.