{"record":{"id":"3c20a8e84234843a","repo":"denoland/deno","slug":"could-not-resolve-the-native-typescript-compiler","errorCode":null,"errorMessage":"could not resolve the native TypeScript compiler; download {} manually and copy its lib/ next to {}","messagePattern":"could not resolve the native TypeScript compiler; download (.+?) manually and copy its lib/ next to (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli/tsc/native.rs","lineNumber":129,"sourceCode":"\n  if tsc_path.exists() {\n    return Ok(tsc_path);\n  }\n\n  let pkg_name = format!(\"@typescript/typescript-{}\", target);\n  let nv = PackageNv::from_str(&format!(\"{}@{}\", pkg_name, TYPESCRIPT_VERSION))\n    .unwrap();\n  let mut info = api.package_info(&pkg_name).await?;\n  let version_info = match info.version_info(&nv, &workspace_link_packages.0) {\n    Ok(version_info) => version_info,\n    Err(_) => {\n      api.mark_force_reload();\n      info = api.package_info(&pkg_name).await?;\n      info.version_info(&nv, &workspace_link_packages.0)?\n    }\n  };\n  let Some(dist) = &version_info.dist else {\n    anyhow::bail!(\n      \"could not resolve the native TypeScript compiler; download {} manually and copy its lib/ next to {}\",\n      nv,\n      tsc_path.display()\n    );\n  };\n\n  let registry_url = npmrc.get_registry_url(&nv.name);\n  let package_folder =\n    npm_cache.package_folder_for_nv_and_url(&nv, registry_url);\n  let existed = package_folder.exists();\n  if !existed {\n    // `ensure_package` downloads the tarball and verifies it against the\n    // registry `dist` integrity/shasum before extracting (the standard npm\n    // pipeline), so the materialized compiler is checksum-validated at install.\n    tarball_cache\n      .ensure_package(&nv, dist)\n      .await\n      .with_context(|| {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tsc/native.rs#L111-L147","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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>/","Check .npmrc/registry configuration and point at a registry that serves @typescript packages with dist metadata, then retry","Alternatively set DENO_TSC_BIN to a locally available tsc binary to bypass the download entirely"],"exampleFix":"# manual recovery per the message\nnpm pack @typescript/typescript-linux-x64@7.0.2\ntar -xzf typescript-typescript-linux-x64-7.0.2.tgz -C /tmp/tsctar\nmkdir -p \"$DENO_DIR/tsc/7.0.2/linux-x64\"\ncp -r /tmp/tsctar/package/lib \"$DENO_DIR/tsc/7.0.2/linux-x64/lib\"","handlingStrategy":"fallback","validationCode":"# bash: pre-seed the compiler cache or point at a local binary\nif [ -n \"$DENO_TSC_BIN\" ] && [ -x \"$DENO_TSC_BIN\" ]; then\n  deno check mod.ts   # uses the local binary, no registry resolution\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a registry that fully mirrors the @typescript scope (including dist metadata) in .npmrc","Pre-populate $DENO_DIR/tsc/<version>/<platform>/lib in offline images","Set DENO_TSC_BIN as the escape hatch when the registry cannot serve the compiler"],"tags":["tsc","npm","registry","download"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}