{"record":{"id":"080226d4d91988f4","repo":"davila7/claude-code-templates","slug":"failed-to-launch-node-cli-e-is-node-js-install","errorCode":null,"errorMessage":"failed to launch Node CLI: {e}. Is Node.js installed?","messagePattern":"failed to launch Node CLI: (.+?)\\. Is Node\\.js installed\\?","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli-rust/src/commands/delegate.rs","lineNumber":19,"sourceCode":"//! Delegation to the existing Node.js CLI for features not yet ported natively\n//! (dashboards, sandbox, global agents, stats, health-check, interactive setup).\n//!\n//! Resolution order for the Node entry point:\n//! 1. `CCT_NODE_BIN` env var — path to `create-claude-config.js` (run with\n//!    `node`) or an executable to invoke directly. Used for local testing.\n//! 2. Fallback: `npx -y claude-code-templates@latest <args>`.\n//!\n//! The original process args (everything after the binary name) are forwarded\n//! verbatim with inherited stdio, so the delegated command behaves identically.\n\nuse anyhow::{anyhow, Result};\nuse std::process::Command;\n\npub fn delegate_to_node(forwarded_args: &[String]) -> Result<i32> {\n    let mut command = build_command(forwarded_args)?;\n    let status = command\n        .status()\n        .map_err(|e| anyhow!(\"failed to launch Node CLI: {e}. Is Node.js installed?\"))?;\n    // Preserve the child's termination semantics: a normal exit code, or for a\n    // signal-killed child on Unix, the shell convention 128 + signal.\n    let code = status.code().unwrap_or_else(|| {\n        #[cfg(unix)]\n        {\n            use std::os::unix::process::ExitStatusExt;\n            status.signal().map(|s| 128 + s).unwrap_or(1)\n        }\n        #[cfg(not(unix))]\n        {\n            1\n        }\n    });\n    Ok(code)\n}\n\nfn build_command(forwarded_args: &[String]) -> Result<Command> {\n    if let Ok(node_bin) = std::env::var(\"CCT_NODE_BIN\") {","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-rust/src/commands/delegate.rs#L1-L37","documentation":"Rust CLI error when spawning the Node CLI subprocess fails: Command::status() returns Err, meaning the node executable could not be launched at all (not that the CLI errored). The message suggests Node.js is missing or not on PATH.","triggerScenarios":"Running the Rust wrapper (e.g. `cli-rust --agent x`) where `node` is not found (ENOENT), not executable (EACCES), or process limits prevent spawning.","commonSituations":"Node not installed or removed; PATH differs when invoked from a GUI/launcher/systemd vs a shell; nvm-managed node not on PATH in non-login shells; Windows without node.exe in PATH.","solutions":["Verify node is installed and on PATH: `node --version` from the same environment","Use an absolute node path or fix PATH (nvm use, or add node to the invoking environment's PATH)","Reinstall Node.js (>= required version) if the binary is broken","On Linux/macOS check execute permissions and ulimit on processes"],"exampleFix":"# before\nexport PATH=/usr/local/bin:/usr/bin:/bin   # node installed via nvm, not found\n# after\nexport PATH=\"$HOME/.nvm/versions/node/v22.11.0/bin:$PATH\"\ncli-rust --agent frontend-developer","handlingStrategy":"validation","validationCode":"use std::process::Command;\nfn node_available() -> bool {\n    Command::new(\"node\").arg(\"--version\").output().is_ok()\n}\n// call before delegate_to_node; fall back to npx or a bundled binary if false","typeGuard":null,"tryCatchPattern":"match cmd.status() {\n    Ok(status) => Ok(status.code().unwrap_or(1)),\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound =>\n        suggest_install_node(),\n    Err(e) => Err(anyhow!(\"failed to launch Node CLI: {e}\")),\n}","preventionTips":["Check `node --version` during install of the Rust wrapper","Resolve node via `which node` and pass an absolute path","For GUI/CI launches, set PATH explicitly to include the Node bin directory"],"tags":["rust","node-not-found","subprocess","path"],"backgroundTag":"node-executable-not-found","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}