DioxusLabs/dioxus · error · anyhow::Error

esbuild binary not found in archive (expected one of {}). Fo

Error message

esbuild binary not found in archive (expected one of {}). Found entries: {}

What it means

After downloading the @esbuild/<platform> tar.gz, dx iterates the archive looking for the expected binary path(s) under package/bin/esbuild[.exe]. If no entry matches, it bails, listing up to 10 sorted entries it did find — which usually reveals a corrupted download, a proxy/mirror returning an HTML error page, or an unexpected archive layout for the pinned version.

Source

Thrown at packages/cli/src/esbuild.rs:143

            let mut entry = entry.context("Failed to read tar entry")?;
            let path = entry.path().context("Failed to read entry path")?;
            let path_string = path.to_string_lossy().replace('\\', "/");

            if expected_paths.contains(&path_string) {
                let mut data = Vec::new();
                entry
                    .read_to_end(&mut data)
                    .context("Failed to read esbuild binary from archive")?;
                return Ok(data);
            }

            archive_entries.push(path_string);
        }

        archive_entries.sort();
        archive_entries.truncate(10);

        anyhow::bail!(
            "esbuild binary not found in archive (expected one of {}). Found entries: {}",
            expected_paths.join(", "),
            archive_entries.join(", ")
        );
    }

    /// Map the host platform to the npm package name for esbuild.
    ///
    /// esbuild publishes per-platform packages under `@esbuild/{name}`:
    /// - darwin-arm64, darwin-x64
    /// - linux-x64, linux-arm64
    /// - win32-x64, win32-arm64
    /// - freebsd-x64, freebsd-arm64
    fn npm_platform_package() -> Option<&'static str> {
        if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
            Some("darwin-arm64")
        } else if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
            Some("darwin-x64")

View on GitHub (pinned to 393d190a80)

Solutions

  1. Delete the CLI's cached esbuild install directory so it re-downloads cleanly
  2. Inspect/clear NPM_CONFIG_REGISTRY and verify the tarball yourself: {registry}/@esbuild/{platform}/-/{platform}-0.27.3.tgz should list package/bin/esbuild
  3. Temporarily enable no-download mode and use a PATH-installed esbuild (npm i -g esbuild@0.27.3) to bypass the fetch entirely
  4. Compare the 'Found entries' list in the error with the expected package/bin/esbuild path to identify what was actually downloaded
Defensive patterns

Strategy: retry

Validate before calling

# Verify the registry serves a well-formed tarball before building
REGISTRY="${NPM_CONFIG_REGISTRY:-https://registry.npmjs.org}"
curl -fsSL "$REGISTRY/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz" | tar tz | grep -q 'package/bin/esbuild' || echo 'registry mirror serving bad archives'

Prevention

When it happens

Trigger: NPM_CONFIG_REGISTRY (or npm_config_registry) pointing at a mirror that serves truncated or rewritten tarballs; a flaky network producing a partial download; archive layout drift for esbuild 0.27.3.

Common situations: Corporate Artifactory/Nexus proxies mangling npm tarballs; flaky CI networking; a custom registry whose path scheme differs from registry.npmjs.org.

Related errors


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