{"record":{"id":"78baa986f74267da","repo":"zed-industries/zed","slug":"failed-to-run-node-version-stdout-stderr","errorCode":null,"errorMessage":"failed to run node --version. stdout: {}, stderr: {}","messagePattern":"failed to run node --version\\. stdout: (.+?), stderr: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/node_runtime/src/node_runtime.rs","lineNumber":868,"sourceCode":"}\n\n#[derive(Debug, Clone)]\npub struct SystemNodeRuntime {\n    node: PathBuf,\n    npm: PathBuf,\n    scratch_dir: PathBuf,\n}\n\nimpl SystemNodeRuntime {\n    const MIN_VERSION: semver::Version = Version::new(22, 0, 0);\n    async fn new(node: PathBuf, npm: PathBuf) -> Result<Self> {\n        let output = util::command::new_command(&node)\n            .arg(\"--version\")\n            .output()\n            .await\n            .with_context(|| format!(\"running node from {:?}\", node))?;\n        if !output.status.success() {\n            anyhow::bail!(\n                \"failed to run node --version. stdout: {}, stderr: {}\",\n                String::from_utf8_lossy(&output.stdout),\n                String::from_utf8_lossy(&output.stderr),\n            );\n        }\n        let version_str = String::from_utf8_lossy(&output.stdout);\n        let version = semver::Version::parse(version_str.trim().trim_start_matches('v'))?;\n        if version < Self::MIN_VERSION {\n            anyhow::bail!(\n                \"node at {} is too old. want: {}, got: {}\",\n                node.to_string_lossy(),\n                Self::MIN_VERSION,\n                version\n            )\n        }\n\n        let scratch_dir = paths::data_dir().join(\"node\");\n        fs::create_dir(&scratch_dir).await.ok();","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/node_runtime/src/node_runtime.rs#L850-L886","documentation":"SystemNodeRuntime::new sanity-checks a system-provided node binary by executing `node --version`. If the process runs but exits non-zero, the failure bails with the captured stdout and stderr. (A failure even to spawn the process produces the earlier `running node from {path}` context instead.)","triggerScenarios":"The node binary found on PATH executes but errors: a corrupted or wrong-architecture binary that dies on startup, a wrapper/shim (nvm, volta, mise) whose underlying install is broken, or a sandbox/AV blocking the exec so it exits with an error code.","commonSituations":"Half-finished nvm/volta installs; macOS quarantine attributes on a manually copied node; Docker images where node is a broken symlink shim; SELinux/AppArmor denials.","solutions":["Run `node --version` yourself with the same PATH Zed uses — reproduce and read the stderr","Reinstall Node (or fix the version manager shims: `nvm reinstall <version>`, `volta install node`)","Clear quarantine on a copied binary: xattr -d com.apple.quarantine $(which node)","Point Zed at a healthy node via PATH, or remove system node so the bundled runtime is used"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"async fn node_runs(node: &Path) -> bool {\n    util::command::new_command(node)\n        .arg(\"--version\")\n        .output()\n        .await\n        .map(|o| o.status.success())\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match SystemNodeRuntime::new(node, npm).await {\n    Err(e) if e.to_string().contains(\"node --version\") => {\n        // binary is broken: fall back to the bundled downloader\n        NodeRuntime::install_if_needed(&http).await?\n    }\n    r => r?,\n}","preventionTips":["Verify `node --version` succeeds in the exact environment (PATH, shell, sandbox) before opting into the system runtime","Reinstall via the version manager rather than copying binaries around","On macOS, clear quarantine attributes from manually installed node binaries"],"tags":["node","system-runtime","process","environment"],"backgroundTag":"node-version-check-failed","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}