{"record":{"id":"bf0a60bc924634b0","repo":"vercel/next.js","slug":"node-js-version-parse-error","errorCode":null,"errorMessage":"Node.js version parse error","messagePattern":"Node\\.js version parse error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"turbopack/crates/turbopack-core/src/environment.rs","lineNumber":356,"sourceCode":"    // This isn't actually the Edge's worker environment, but we have to use some kind of version\n    // for transpiling ECMAScript features. No tool supports Edge Workers as a separate\n    // environment.\n    pub node_version: ResolvedVc<NodeJsVersion>,\n}\n\n#[turbo_tasks::value_impl]\nimpl EdgeWorkerEnvironment {\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).map_err(|_| anyhow!(\"Node.js version parse error\"))?,\n            ),\n            ..Default::default()\n        }))\n    }\n}\n\n// TODO preset_env_base::Version implements Serialize/Deserialize incorrectly\n#[derive(Debug)]\n#[turbo_tasks::value(transparent, serialization = \"skip\")]\npub struct RuntimeVersions(#[turbo_tasks(trace_ignore)] pub Versions);\n\n#[turbo_tasks::value_impl]\nimpl RuntimeVersions {\n    /// Whether the environment supports arrow functions.\n    #[turbo_tasks::function]\n    pub fn supports_arrow_functions(&self) -> Vc<bool> {\n        // https://github.com/babel/babel/blob/b0e3517dc566880e76b5f1f4dcf7fcecba58337d/packages/babel-compat-data/data/plugins.json#L363-L376\n        // \"chrome\": \"47\",","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/turbopack/crates/turbopack-core/src/environment.rs#L338-L374","documentation":"Thrown by EdgeWorkerEnvironment::runtime_versions() when the resolved Node.js version string cannot be parsed into a semver Version via preset_env_base::Version::from_str. The version string originates either from shelling out to `node --version` (stripped of its leading 'v') or from a statically configured NodeJsVersion value. Parsing fails when the string is not a plain numeric semver like \"20.11.0\".","triggerScenarios":"Constructing an EdgeWorkerEnvironment whose node_version resolves to a non-semver string (e.g. a literal like \"lts/hydrogen\", \"current\", an empty string, or text with unexpected suffixes). Also fires when `node --version` emits output that, after stripping 'v', isn't valid semver.","commonSituations":"Passing a custom environment-version string that carries a distribution label or channel suffix; an unusual/corrupted Node.js installation whose --version prints non-semver text; misconfiguration of a static node version in Turbopack environment wiring.","solutions":["Use a plain semver string (major.minor.patch, e.g. \"20.11.0\") for any statically configured NodeJsVersion.","Run `node --version` in the project shell and confirm it prints a standard `vX.Y.Z`; fix or replace the broken Node binary if not.","If you derive the version programmatically, strip all non-numeric/channel suffixes before passing it to the environment.","Check that no wrapper script or version manager (nvm/fnm) is injecting non-semver output into `node --version`."],"exampleFix":"// before\nNodeJsVersion::Static(ResolvedVc::cell(rcstr!(\"lts/hydrogen\")))\n\n// after\nNodeJsVersion::Static(ResolvedVc::cell(rcstr!(\"20.11.0\")))","handlingStrategy":"validation","validationCode":"// Validate a version string is plain semver before passing it as a static NodeJsVersion.\nfn is_plain_semver(s: &str) -> bool {\n    let mut parts = s.split('.');\n    parts.clone().take(3).all(|p| p.parse::<u64>().is_ok())\n        && parts.next().is_none() // exactly major.minor.patch\n}\n\n// usage\nlet v = \"20.11.0\";\nassert!(is_plain_semver(v), \"node version must be plain semver\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass distribution labels (\"lts/*\", \"current\") as a static node version — always major.minor.patch.","Pin the Node version with a tool like nvm/fnm so `node --version` is deterministic in CI.","If you derive the version at runtime, run it through a semver parser before handing it to the environment."],"tags":["node-version","edge-environment","configuration","semver"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}