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

  1. Install esbuild manually and put it on PATH (distro package or build from source) so the npm download path is skipped
  2. Do the build inside a container for a supported arch (x64 or arm64) and reuse the artifacts
  3. Pair this with download-free mode so dx uses your PATH esbuild instead of attempting the fetch
  4. 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

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


AI-assisted analysis of DioxusLabs/dioxus@393d190a80 (2026-08-16). Data as JSON: /api/errors/cfb6f36e0f6e5996. Report an issue: GitHub.