{"record":{"id":"8dfc9703ea17575d","repo":"vercel/next.js","slug":"failed-to-parse-node-js-version","errorCode":null,"errorMessage":"Failed to parse Node.js version: '{}'","messagePattern":"Failed to parse Node\\.js version: '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"turbopack/crates/turbopack-core/src/environment.rs","lineNumber":296,"sourceCode":"            cwd: ResolvedVc::cell(None),\n        }\n    }\n}\n\n#[turbo_tasks::value_impl]\nimpl NodeJsEnvironment {\n    #[turbo_tasks::function]\n    pub async fn runtime_versions(&self) -> Result<Vc<RuntimeVersions>> {\n        let str = match *self.node_version.await? {\n            NodeJsVersion::Current(process_env) => get_current_nodejs_version(*process_env),\n            NodeJsVersion::Static(version) => *version,\n        }\n        .await?;\n\n        Ok(Vc::cell(Versions {\n            node: Some(\n                Version::from_str(&str)\n                    .map_err(|_| anyhow!(\"Failed to parse Node.js version: '{}'\", str))?,\n            ),\n            ..Default::default()\n        }))\n    }\n\n    #[turbo_tasks::function]\n    pub async fn current(process_env: ResolvedVc<Box<dyn ProcessEnv>>) -> Result<Vc<Self>> {\n        Ok(Self::cell(NodeJsEnvironment {\n            compile_target: CompileTarget::current().to_resolved().await?,\n            node_version: NodeJsVersion::cell(NodeJsVersion::Current(process_env))\n                .to_resolved()\n                .await?,\n            cwd: ResolvedVc::cell(None),\n        }))\n    }\n}\n\n#[turbo_tasks::value(shared)]","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/turbopack/crates/turbopack-core/src/environment.rs#L278-L314","documentation":"Thrown by NodeJsEnvironment.runtime_versions() when Version::from_str fails to parse the Node.js version string. The version string comes either from `node --version` (via the process env / Current variant) or a Static configured version, and must parse into a semver Version; garbage input fails parsing.","triggerScenarios":"The detected Node.js version string (from get_current_nodejs_version or a static NodeJsVersion) is not valid semver — e.g. 'v', an empty string, a non-numeric tag, or a malformed custom version. Version::from_str rejects it and the error reports the offending string.","commonSituations":"A custom/packaged Node build reporting an unusual `node --version` output; NODEJS_VERSION-like env override set to a non-semver value; a forked Node runtime; corrupted version detection.","solutions":["Run `node --version` and confirm it outputs a normal semver string like 'v20.11.0'; if not, switch to a standard Node.js build.","If a static NodeJsVersion is configured, ensure it is valid semver (e.g. '20.11.0').","Remove any env overrides that tamper with the detected Node version and rebuild."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm a parseable Node version before building.\nconst { execSync } = require('child_process')\nconst v = execSync('node --version').toString().trim() // e.g. v20.11.0\nif (!/^v?\\d+\\.\\d+\\.\\d+/.test(v)) {\n  throw new Error(`Unparseable Node.js version: '${v}'`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a standard Node.js distribution that reports a normal semver `node --version`.","Don't override Node version detection env vars with non-semver values.","Pin a known-good Node version in CI via nvm/volta/nvs."],"tags":["turbopack","environment","node-version","semver","runtime"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}