{"record":{"id":"5cf592a0161820c5","repo":"DioxusLabs/dioxus","slug":"esbuild-binary-not-found-in-archive-expected-one","errorCode":null,"errorMessage":"esbuild binary not found in archive (expected one of {}). Found entries: {}","messagePattern":"esbuild binary not found in archive \\(expected one of (.+?)\\)\\. Found entries: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/esbuild.rs","lineNumber":143,"sourceCode":"            let mut entry = entry.context(\"Failed to read tar entry\")?;\n            let path = entry.path().context(\"Failed to read entry path\")?;\n            let path_string = path.to_string_lossy().replace('\\\\', \"/\");\n\n            if expected_paths.contains(&path_string) {\n                let mut data = Vec::new();\n                entry\n                    .read_to_end(&mut data)\n                    .context(\"Failed to read esbuild binary from archive\")?;\n                return Ok(data);\n            }\n\n            archive_entries.push(path_string);\n        }\n\n        archive_entries.sort();\n        archive_entries.truncate(10);\n\n        anyhow::bail!(\n            \"esbuild binary not found in archive (expected one of {}). Found entries: {}\",\n            expected_paths.join(\", \"),\n            archive_entries.join(\", \")\n        );\n    }\n\n    /// Map the host platform to the npm package name for esbuild.\n    ///\n    /// esbuild publishes per-platform packages under `@esbuild/{name}`:\n    /// - darwin-arm64, darwin-x64\n    /// - linux-x64, linux-arm64\n    /// - win32-x64, win32-arm64\n    /// - freebsd-x64, freebsd-arm64\n    fn npm_platform_package() -> Option<&'static str> {\n        if cfg!(all(target_os = \"macos\", target_arch = \"aarch64\")) {\n            Some(\"darwin-arm64\")\n        } else if cfg!(all(target_os = \"macos\", target_arch = \"x86_64\")) {\n            Some(\"darwin-x64\")","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/cli/src/esbuild.rs#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"Corporate Artifactory/Nexus proxies mangling npm tarballs; flaky CI networking; a custom registry whose path scheme differs from registry.npmjs.org.","solutions":["Delete the CLI's cached esbuild install directory so it re-downloads cleanly","Inspect/clear NPM_CONFIG_REGISTRY and verify the tarball yourself: {registry}/@esbuild/{platform}/-/{platform}-0.27.3.tgz should list package/bin/esbuild","Temporarily enable no-download mode and use a PATH-installed esbuild (npm i -g esbuild@0.27.3) to bypass the fetch entirely","Compare the 'Found entries' list in the error with the expected package/bin/esbuild path to identify what was actually downloaded"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# Verify the registry serves a well-formed tarball before building\nREGISTRY=\"${NPM_CONFIG_REGISTRY:-https://registry.npmjs.org}\"\ncurl -fsSL \"$REGISTRY/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz\" | tar tz | grep -q 'package/bin/esbuild' || echo 'registry mirror serving bad archives'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point NPM_CONFIG_REGISTRY at a trustworthy mirror or unset it","Clear the cached esbuild install dir after any network incident","Keep an escape hatch: PATH esbuild + no-download mode skips the archive path entirely"],"tags":["cli","esbuild","npm","download","archive"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}