DioxusLabs/dioxus · error · anyhow::Error
esbuild not found on PATH and downloads are disabled
Error message
esbuild not found on PATH and downloads are disabled
What it means
The CLI uses a pinned esbuild (ESBUILD_VERSION 0.27.3) for JS/TS asset processing and auto-downloads it on demand — unless download-free mode is enabled via CliSettings::prefer_no_downloads(). In that mode get_or_install only probes PATH with which::which; if no esbuild binary is found, it fails immediately with this message and never hits the network.
Source
Thrown at packages/cli/src/esbuild.rs:22
//! previous SWC Rust library dependencies. The standalone Go binary is
//! downloaded from the npm registry and cached locally.
use crate::{CliSettings, Workspace};
use anyhow::{Context, anyhow};
use std::path::PathBuf;
/// Pinned esbuild version.
const ESBUILD_VERSION: &str = "0.27.3";
pub(crate) struct Esbuild;
impl Esbuild {
/// Ensure the esbuild binary is available, downloading if needed.
/// Returns the path to the binary.
pub(crate) async fn get_or_install() -> anyhow::Result<PathBuf> {
if CliSettings::prefer_no_downloads() {
which::which("esbuild")
.map_err(|_| anyhow!("esbuild not found on PATH and downloads are disabled"))
} else {
let path = Self::installed_bin_path();
if !path.exists() {
Self::install_from_npm().await?;
}
Ok(path)
}
}
/// Return the esbuild binary path if it's already been installed or is on PATH.
/// This is a sync check intended for use after `verify_tooling` has been called.
pub(crate) fn path_if_installed() -> Option<PathBuf> {
let path = Self::installed_bin_path();
if path.exists() {
Some(path)
} else {
which::which("esbuild").ok()
}View on GitHub (pinned to 393d190a80)
Solutions
- Install esbuild globally and make sure it is on PATH: npm install -g esbuild@0.27.3 (or brew install esbuild)
- Re-enable downloads (unset the no-downloads CLI/DX setting) so dx fetches its pinned copy automatically
- Pin the same version as the CLI (0.27.3) so behavior matches the bundled toolchain
Defensive patterns
Strategy: validation
Validate before calling
# Pre-check the toolchain when downloads are disabled command -v esbuild >/dev/null || npm install -g esbuild@0.27.3
Prevention
- Bake esbuild 0.27.3 into offline CI images
- Verify with `which esbuild` before any no-download build
- Pin the same version as the CLI to avoid behavioral drift
When it happens
Trigger: Building (dx build/serve/bundle) with JS/TS assets on a machine where downloads are disabled (offline/air-gapped policy, DX no-download setting) and esbuild is not installed or not on PATH.
Common situations: Hermetic CI images that forbid network access; corporate proxies blocking registry.npmjs.org; local dev with the no-downloads preference toggled on but the toolchain never installed.
Related errors
- No esbuild binary available for this platform
- esbuild binary not found in archive (expected one of {}). Fo
- esbuild failed: {stderr}
- failed to expand ifunc table
- Syntax Error in line {line} column {column}: {err}
AI-assisted analysis of DioxusLabs/dioxus@393d190a80 (2026-08-16).
Data as JSON: /api/errors/74be5a1f1bfa15d3.
Report an issue: GitHub.