denoland/deno · error

Failed to execute deno

Error message

Failed to execute deno

What it means

libs/node_shim builds the tiny `node` executable that forwards Node-style CLI invocations to Deno. On Windows it spawns `deno` via Command::new("deno").status(), and this expect() panics when the deno binary cannot be launched — overwhelmingly because no `deno.exe` is found on PATH (or the resolved file is not executable). The Unix branch differs: exec() failure prints "Failed to execute deno" and exits 1 instead of panicking.

Source

Thrown at libs/node_shim/main.rs:78

  // Execute deno with the translated arguments
  #[cfg(unix)]
  {
    use std::os::unix::process::CommandExt;
    let err = process::Command::new("deno")
      .arg0(&deno_args[0])
      .args(&deno_args[1..])
      .exec();
    eprintln!("Failed to execute deno: {}", err);
    process::exit(1);
  }

  #[cfg(not(unix))]
  {
    let status = process::Command::new("deno")
      .args(&deno_args[1..])
      .status()
      .expect("Failed to execute deno");
    process::exit(status.code().unwrap_or(1));
  }
}

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Install Deno so `deno` resolves: PowerShell `irm https://deno.land/install.ps1 | iex` or `winget install DenoLand.Deno`.
  2. Verify resolution with `where.exe deno` and `deno --version` in the same shell/session the shim runs in; add Deno's install dir (e.g. %USERPROFILE%\.deno\bin) to PATH.
  3. If the shim is shipped inside your own distribution, also distribute deno.exe or document the requirement, since the shim only forwards.
  4. In CI, add an explicit Deno setup step before any tooling that invokes the node shim.

Example fix

# before (CI fails with: Failed to execute deno)
- run: node build.js

# after
- run: |
    irm https://deno.land/install.ps1 | iex
    $env:Path += ";$env:USERPROFILE\.deno\bin"
    node build.js
Defensive patterns

Strategy: validation

Validate before calling

REM Windows: confirm the shim will find deno before invoking it
where.exe deno
deno --version

Prevention

When it happens

Trigger: Running the node shim (node script.js / npm-style wrappers) on a machine where Deno is not installed or `deno` is not on PATH — fresh CI images, containers, or machines where Deno was installed per-user but the shim runs under a different account.

Common situations: Windows App Execution Aliases shadowing or missing; Deno installed via a user profile dir not on the system PATH seen by the shell running the shim; CI windows-latest runners without a deno install step; renaming/moving the deno.exe after install.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/71fd5f5b77f5df1c. Report an issue: GitHub.