DioxusLabs/dioxus · error · anyhow::Error
No esbuild binary available for this platform
Error message
No esbuild binary available for this platform
What it means
When downloads are allowed, dx fetches esbuild from npm by mapping the host platform to an @esbuild/<platform> package (darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64, win32-arm64). npm_platform_package returns None for anything else, and install_from_npm bails immediately with this error before any request is made.
Source
Thrown at packages/cli/src/esbuild.rs:60
/// The path where we cache the esbuild binary.
fn installed_bin_path() -> PathBuf {
let dir = Workspace::tools_dir().join(format!("esbuild-{ESBUILD_VERSION}"));
let name = if cfg!(windows) {
"esbuild.exe"
} else {
"esbuild"
};
dir.join(name)
}
/// Download esbuild from the npm registry and extract the binary.
///
/// esbuild publishes platform-specific packages to npm as tar.gz archives.
/// Each archive contains `package/bin/esbuild[.exe]`.
async fn install_from_npm() -> anyhow::Result<()> {
let platform = Self::npm_platform_package()
.ok_or_else(|| anyhow!("No esbuild binary available for this platform"))?;
let registry = std::env::var("NPM_CONFIG_REGISTRY")
.or_else(|_| std::env::var("npm_config_registry"))
.unwrap_or_else(|_| "https://registry.npmjs.org".to_string());
let registry = registry.trim_end_matches('/');
let url = format!("{registry}/@esbuild/{platform}/-/{platform}-{ESBUILD_VERSION}.tgz");
tracing::info!("Installing esbuild v{ESBUILD_VERSION} from {url}...");
let bytes = reqwest::get(&url)
.await
.with_context(|| format!("Failed to download esbuild from {url}"))?
.bytes()
.await
.context("Failed to read esbuild download response")?;
// Extract `package/bin/esbuild[.exe]` from the tar.gz
let binary_data = Self::extract_binary_from_tgz(&bytes)?;View on GitHub (pinned to 393d190a80)
Solutions
- Install esbuild manually and put it on PATH (distro package or build from source) so the npm download path is skipped
- Do the build inside a container for a supported arch (x64 or arm64) and reuse the artifacts
- Pair this with download-free mode so dx uses your PATH esbuild instead of attempting the fetch
- File an upstream issue requesting support for your platform
Defensive patterns
Strategy: fallback
Validate before calling
# Supported @esbuild platforms: darwin-arm64 darwin-x64 linux-x64 linux-arm64 win32-x64 win32-arm64 # Pre-flight in CI: case "$(uname -s)/$(uname -m)" in Darwin/arm64|Darwin/x86_64|Linux/x86_64|Linux/aarch64) echo ok ;; *) echo 'unsupported for esbuild download — preinstall on PATH' ;; esac
Prevention
- Build on x64/arm64 across the three major OSes to stay inside the supported matrix
- Preinstall esbuild on unusual platforms and run dx in no-download mode
- Containerize exotic-arch builds against a supported arch and copy artifacts out
When it happens
Trigger: Running a build that needs esbuild on an OS/arch combination outside the supported npm package list — e.g. linux-riscv64, freebsd, i686 windows, or unusual musl targets.
Common situations: Building on niche architectures or alternative operating systems; exotic container images (Alpine on uncommon archs); CI runners on platforms esbuild does not publish prebuilds for.
Related errors
- esbuild not found on PATH and downloads are disabled
- esbuild binary not found in archive (expected one of {}). Fo
- esbuild failed: {stderr}
- Syntax Error in line {line} column {column}: {err}
- Package type '{invalid:?}' is not supported for bundle forma
AI-assisted analysis of DioxusLabs/dioxus@393d190a80 (2026-08-16).
Data as JSON: /api/errors/cfb6f36e0f6e5996.
Report an issue: GitHub.