denoland/deno · error · AnyError

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

`ensure_native_tsc` resolves `@typescript/typescript-<platform>@<TYPESCRIPT_VERSION>` through the configured npm registry and needs the version's `dist` block (tarball URL + integrity hash) to download the compiler. If `version_info.dist` is None — even after one forced registry reload (cli/tsc/native.rs:123) — Deno cannot build a download and bails, telling you to fetch the package manually and place its `lib/` next to the expected tsc path.

Solutions

  1. Follow the message: `npm pack @typescript/typescript-<platform>@<version>`, extract the tarball, and copy its `lib/` to the path printed in the error (e.g. $DENO_DIR/tsc/<version>/<platform>/lib/).
  2. Or set `DENO_TSC_BIN` to any existing tsc binary — Deno skips the registry entirely.
  3. Fix the registry/mirror so it returns full metadata including dist; verify with `npm view @typescript/typescript-<platform>@<version> dist.tarball`.
  4. Clear the cached npm metadata (`rm -rf "${DENO_DIR:-$HOME/.cache/deno}/npm"`) and retry so the forced reload fetches complete info.

Example fix

# before: deno check fails:
# could not resolve the native TypeScript compiler; download @typescript/typescript-linux-x64@<version> manually ...
npm pack @typescript/typescript-linux-x64
tar -xzf typescript-typescript-linux-x64-*.tgz
mkdir -p "${DENO_DIR:-$HOME/.cache/deno}/tsc/<version>/linux-x64"
cp -r package/lib "${DENO_DIR:-$HOME/.cache/deno}/tsc/<version>/linux-x64/"
deno check main.ts
Defensive patterns

Strategy: fallback

Validate before calling

# verify the registry serves full metadata (dist) for the platform package
npm view @typescript/typescript-<platform>@<version> dist.tarball
# empty output => deno's auto-download will fail with this error

Prevention

When it happens

Trigger: First `deno check` / type-checking run where the registry from .npmrc (`registry=`, scoped registries) returns metadata for the exact package@version but without a `dist` field; or corrupted/stale cached registry metadata under DENO_DIR that still lacks dist after the internal reload retry.

Common situations: Corporate Artifactory/Verdaccio/npm-proxy mirrors that strip or incompletely cache `dist`; air-gapped registries; a project or user .npmrc pointing at a private registry that has the package metadata but not the tarball reference; interrupted earlier metadata fetches leaving a bad cache.

Related errors


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

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