denoland/deno · error · anyhow::Error

could not resolve the native TypeScript compiler; download {

Error message

could not resolve the native TypeScript compiler; download {} manually and copy its lib/ next to {}

What it means

deno resolves `@typescript/typescript-<platform>@7.0.2` through the configured npm registry. If the version metadata carries no `dist` (tarball) info even after a forced registry reload, the compiler cannot be downloaded and the error names the exact package and the target path for a manual install.

Source

Thrown at cli/tsc/native.rs:129

  if tsc_path.exists() {
    return Ok(tsc_path);
  }

  let pkg_name = format!("@typescript/typescript-{}", target);
  let nv = PackageNv::from_str(&format!("{}@{}", pkg_name, TYPESCRIPT_VERSION))
    .unwrap();
  let mut info = api.package_info(&pkg_name).await?;
  let version_info = match info.version_info(&nv, &workspace_link_packages.0) {
    Ok(version_info) => version_info,
    Err(_) => {
      api.mark_force_reload();
      info = api.package_info(&pkg_name).await?;
      info.version_info(&nv, &workspace_link_packages.0)?
    }
  };
  let Some(dist) = &version_info.dist else {
    anyhow::bail!(
      "could not resolve the native TypeScript compiler; download {} manually and copy its lib/ next to {}",
      nv,
      tsc_path.display()
    );
  };

  let registry_url = npmrc.get_registry_url(&nv.name);
  let package_folder =
    npm_cache.package_folder_for_nv_and_url(&nv, registry_url);
  let existed = package_folder.exists();
  if !existed {
    // `ensure_package` downloads the tarball and verifies it against the
    // registry `dist` integrity/shasum before extracting (the standard npm
    // pipeline), so the materialized compiler is checksum-validated at install.
    tarball_cache
      .ensure_package(&nv, dist)
      .await
      .with_context(|| {

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Follow the message: fetch the printed nv tarball (e.g. from registry.npmjs.org) and copy its lib/ directory next to the printed tsc path under $DENO_DIR/tsc/<version>/<platform>/
  2. Check .npmrc/registry configuration and point at a registry that serves @typescript packages with dist metadata, then retry
  3. Alternatively set DENO_TSC_BIN to a locally available tsc binary to bypass the download entirely

Example fix

# manual recovery per the message
npm pack @typescript/typescript-linux-x64@7.0.2
tar -xzf typescript-typescript-linux-x64-7.0.2.tgz -C /tmp/tsctar
mkdir -p "$DENO_DIR/tsc/7.0.2/linux-x64"
cp -r /tmp/tsctar/package/lib "$DENO_DIR/tsc/7.0.2/linux-x64/lib"
Defensive patterns

Strategy: fallback

Validate before calling

# bash: pre-seed the compiler cache or point at a local binary
if [ -n "$DENO_TSC_BIN" ] && [ -x "$DENO_TSC_BIN" ]; then
  deno check mod.ts   # uses the local binary, no registry resolution
fi

Prevention

When it happens

Trigger: A custom registry/mirror (.npmrc) serving the @typescript scope without tarball metadata; the pinned version's platform package being yanked or unpublished; a registry outage or inconsistent cache.

Common situations: Corporate npm proxies (Artifactory/Nexus) that incompletely mirror the @typescript scope; offline environments where the cache was never populated; version skew between the pinned TYPESCRIPT_VERSION and what the mirror serves.

Related errors


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