denoland/deno · error
could not get fetch esbuild binary; download it manually and
Error message
could not get fetch esbuild binary; download it manually and copy it to {} What it means
deno bundle shells out to esbuild, fetching the pinned esbuild npm package on first use and copying its platform binary into DENO_DIR. This bail (cli/tools/bundle/esbuild.rs:150-155) fires when the registry metadata for the pinned esbuild version carries no dist tarball information (version_info.dist is None), so there is nothing to download - typical of broken mirrors, custom registries lacking the package, or proxied/offline environments. The message names the exact path where the binary is expected so it can be installed manually.
Source
Thrown at cli/tools/bundle/esbuild.rs:151
"failed to move esbuild binary into place at {}",
esbuild_path.display()
)
});
}
}
if !existed {
let _ = std::fs::remove_dir_all(&package_folder).inspect_err(|e| {
log::warn!(
"failed to remove directory {}: {}",
package_folder.display(),
e
);
});
}
Ok(esbuild_path)
} else {
anyhow::bail!(
"could not get fetch esbuild binary; download it manually and copy it to {}",
esbuild_path.display()
);
}
}
View on GitHub (pinned to 89f33cbef2)
Solutions
- Check registry connectivity/config: verify the registry URL in npmrc (.npmrc registry=, DENO_ env overrides) and that it serves the esbuild package with dist for the pinned version
- Retry after fixing network/proxy (the earlier download attempts log 'failed to download esbuild package tarball ...' when the tarball itself fails)
- Manually install: download the esbuild binary matching the pinned version for your platform, make it executable, and copy it to the exact path printed in the error (under DENO_DIR; find it via 'deno info')
- Run once from a machine with normal registry access, then copy the cached binary into the same DENO_DIR path on the restricted machine
Example fix
# before: fails with 'could not get fetch esbuild binary; download it manually and copy it to /home/ci/.cache/deno/esbuild-...' deno bundle src/main.ts out.js # after: manual install on the restricted host ESBUILD_PATH=$(deno info | grep 'DENO_DIR' || true) # take the path from the error message, then: cp ./tools/esbuild-linux-x64 /home/ci/.cache/deno/esbuild-X_Y_Z/esbuild chmod +x /home/ci/.cache/deno/esbuild-X_Y_Z/esbuild deno bundle src/main.ts out.js
Defensive patterns
Strategy: fallback
Validate before calling
# Verify the registry serves the pinned esbuild package with a dist tarball
ESBUILD_VERSION=$(deno --version | head -1) # or read from the error message
curl -fsS "${NPM_REGISTRY:-https://registry.npmjs.org}/esbuild" \
| jq -e --arg v "$ESBUILD_VERSION" '.versions[$v].dist.tarball' >/dev/null \
&& echo 'esbuild dist available' || echo 'registry missing esbuild dist - pre-install manually' Try / catch
# Pre-seed the binary from a mirror, then run the bundle
ERRLOG=$(mktemp)
deno bundle src/main.ts out.js 2>&1 | tee "$ERRLOG" || {
path=$(sed -n 's/.*copy it to \(.*\)/\1/p' "$ERRLOG")
[ -n "$path" ] && cp ./vendor/esbuild "$path" && chmod +x "$path" && deno bundle src/main.ts out.js
} Prevention
- On restricted networks, pre-install the pinned esbuild binary into DENO_DIR during image build
- Point npmrc at a registry that proxies the public npm registry including esbuild
- Keep an offline copy of the esbuild binary next to other vendored toolchain artifacts
When it happens
Trigger: npm registry metadata reachable but missing the dist field for the pinned esbuild version (misconfigured mirror, allowlist-style proxy, air-gapped Artifactory/Verdaccio feed without esbuild); registry returning truncated metadata; unusual ESBUILD_VERSION pin not present in the mirror.
Common situations: Corporate networks with a private npm registry that doesn't proxy esbuild; offline/air-gapped build agents; registry outages serving degraded metadata; DENO_DIR on read-only or full disk making earlier install steps silently unavailable.
Related errors
- failed to locate output for HTML entry '{}'; {js_entry_name}
- bundling failed
- esbuild produced no JavaScript output
- esbuild exited before the rebuild completed
- The bench function must have a name
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/adb886cfe8f9a162.
Report an issue: GitHub.