DioxusLabs/dioxus · error
Missing wasm-opt
Error message
Missing wasm-opt
What it means
Failure of wasm_opt::get_binary_path when downloads are disabled (CliSettings::prefer_no_downloads), the tool-cache binary is absent, and which::which("wasm-opt") finds nothing on PATH — the optimizer step cannot proceed without a manual install.
Source
Thrown at packages/cli/src/wasm_opt.rs:226
.ok_or_else(|| anyhow::anyhow!("Failed to get download URL for wasm-opt"))?;
Ok(download_url.to_string())
}
/// Get the path to the wasm-opt binary, downloading it if necessary
pub async fn get_binary_path() -> anyhow::Result<PathBuf> {
let install_dir = install_dir();
let install_path = installed_bin_path(&install_dir);
if install_path.exists() {
return Ok(install_path);
}
if CliSettings::prefer_no_downloads() {
if let Ok(existing) = which::which("wasm-opt") {
return Ok(existing);
} else {
return Err(anyhow!("Missing wasm-opt"));
}
}
tracing::info!("Installing wasm-opt");
install_github(&install_dir).await?;
tracing::info!("wasm-opt installed from Github");
Ok(install_path)
}
pub fn installed_location() -> Option<PathBuf> {
let install_dir = install_dir();
let install_path = installed_bin_path(&install_dir);
if install_path.exists() {
return Some(install_path);
}
View on GitHub (pinned to 24f6a829df)
Solutions
- wasm-opt is missing. Install it from the binaryen releases and add it to PATH.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/cli/src/wasm_opt.rs:226 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/c26c1c72e20c2178.
Report an issue: GitHub.