{"record":{"id":"71fd5f5b77f5df1c","repo":"denoland/deno","slug":"failed-to-execute-deno","errorCode":null,"errorMessage":"Failed to execute deno","messagePattern":"Failed to execute deno","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"libs/node_shim/main.rs","lineNumber":78,"sourceCode":"\n  // Execute deno with the translated arguments\n  #[cfg(unix)]\n  {\n    use std::os::unix::process::CommandExt;\n    let err = process::Command::new(\"deno\")\n      .arg0(&deno_args[0])\n      .args(&deno_args[1..])\n      .exec();\n    eprintln!(\"Failed to execute deno: {}\", err);\n    process::exit(1);\n  }\n\n  #[cfg(not(unix))]\n  {\n    let status = process::Command::new(\"deno\")\n      .args(&deno_args[1..])\n      .status()\n      .expect(\"Failed to execute deno\");\n    process::exit(status.code().unwrap_or(1));\n  }\n}\n","sourceCodeStart":60,"sourceCodeEnd":82,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/node_shim/main.rs#L60-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install Deno so `deno` resolves: PowerShell `irm https://deno.land/install.ps1 | iex` or `winget install DenoLand.Deno`.","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.","If the shim is shipped inside your own distribution, also distribute deno.exe or document the requirement, since the shim only forwards.","In CI, add an explicit Deno setup step before any tooling that invokes the node shim."],"exampleFix":"# before (CI fails with: Failed to execute deno)\n- run: node build.js\n\n# after\n- run: |\n    irm https://deno.land/install.ps1 | iex\n    $env:Path += \";$env:USERPROFILE\\.deno\\bin\"\n    node build.js","handlingStrategy":"validation","validationCode":"REM Windows: confirm the shim will find deno before invoking it\nwhere.exe deno\ndeno --version","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install Deno via the official installer or winget so deno.exe lands on PATH.","In CI, add a Deno setup step and verify with `deno --version` before running anything that uses the node shim.","If you redistribute the node shim, also redistribute deno.exe or document the PATH requirement."],"tags":["node-shim","windows","spawn","path","deno-binary","install"],"backgroundTag":"deno-not-found-on-path","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}