denoland/deno · error · AnyError

Unsupported platform for the native TypeScript compiler

Error message

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

What it means

Deno bootstraps its native TypeScript compiler by mapping the host (arch, os) pair to an npm platform package `@typescript/typescript-<platform>`. `typescript_platform_for` (cli/tsc/native.rs) only knows six targets: x86_64/aarch64 on linux/macos/windows. Any other combination has no published compiler binary to download, so Deno bails immediately rather than guess or silently skip type checking.

Solutions

  1. Skip the native compiler: run with `deno run --no-check` / `deno compile --no-check` on that host.
  2. Set `DENO_TSC_BIN` to an existing native tsc binary you built yourself; Deno uses it directly and skips the download (see cli/tsc/native.rs:90).
  3. Move the workload to a supported host: x86_64 or aarch64 on Linux, macOS, or Windows.
  4. If a @typescript/typescript-<platform> package actually exists for your target, patch the match in `typescript_platform_for` and build a custom Deno.

Example fix

# before (riscv64 linux: no mapping exists)
deno check main.ts
# error: Unsupported platform for the native TypeScript compiler: riscv64gc linux

# after: skip the native compiler on this host
deno run --no-check main.ts
Defensive patterns

Strategy: fallback

Validate before calling

# unix pre-flight: warn before running deno on an unmapped host
arch="$(uname -m)"; os="$(uname -s)"
case "$arch:$os" in
  x86_64:Linux|aarch64:Linux|x86_64:Darwin|aarch64:Darwin) ;;
  *) echo "native tsc unavailable on $arch $os — use --no-check or set DENO_TSC_BIN" ;;
esac

Prevention

When it happens

Trigger: Running a command that needs the native tsc (`deno check`, or `deno run`/`deno compile` with type-checking enabled) on a host where std::env::consts::ARCH/OS is not one of the six supported pairs: e.g. riscv64-linux, x86_64-freebsd, 32-bit arm-linux, or any BSD. The check runs before any network access, so it fails deterministically on the first invocation.

Common situations: From-source Deno builds on niche architectures (RISC-V boards, FreeBSD CI, 32-bit ARM SBCs); custom cross-compile targets that report unusual arch/os strings; CI agents on uncommon platforms that work for everything except type checking.

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/f52cbd1e527cc79d. Report an issue: GitHub.

Appendix: 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 9ad36f7a2c)