diff --git a/cli/src/connection.rs b/cli/src/connection.rs index bc50d32..3d209d6 100644 --- a/cli/src/connection.rs +++ b/cli/src/connection.rs @@ -206,8 +206,12 @@ pub fn ensure_daemon(session: &str, headed: bool) -> Result<(), String> { { use std::os::windows::process::CommandExt; - let mut cmd = Command::new("node"); - cmd.arg(daemon_path) + // On Windows, use cmd.exe to run node to ensure proper PATH resolution + // This handles cases where node.exe isn't directly in PATH but node.cmd is + let mut cmd = Command::new("cmd"); + cmd.arg("/c") + .arg("node") + .arg(daemon_path) .env("AGENT_BROWSER_DAEMON", "1") .env("AGENT_BROWSER_SESSION", session); diff --git a/cli/src/install.rs b/cli/src/install.rs index 297af2b..72fc7f3 100644 --- a/cli/src/install.rs +++ b/cli/src/install.rs @@ -128,6 +128,15 @@ pub fn run_install(with_deps: bool) { } println!("\x1b[36mInstalling Chromium browser...\x1b[0m"); + + // On Windows, we need to use cmd.exe to run npx because npx is actually npx.cmd + // and Command::new() doesn't resolve .cmd files the way the shell does + #[cfg(windows)] + let status = Command::new("cmd") + .args(["/c", "npx", "playwright", "install", "chromium"]) + .status(); + + #[cfg(not(windows))] let status = Command::new("npx") .args(["playwright", "install", "chromium"]) .status();