vercel/next.js · error
Failed to parse Node.js version: '{}'
Error message
Failed to parse Node.js version: '{}' What it means
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.
Source
Thrown at turbopack/crates/turbopack-core/src/environment.rs:296
cwd: ResolvedVc::cell(None),
}
}
}
#[turbo_tasks::value_impl]
impl NodeJsEnvironment {
#[turbo_tasks::function]
pub async fn runtime_versions(&self) -> Result<Vc<RuntimeVersions>> {
let str = match *self.node_version.await? {
NodeJsVersion::Current(process_env) => get_current_nodejs_version(*process_env),
NodeJsVersion::Static(version) => *version,
}
.await?;
Ok(Vc::cell(Versions {
node: Some(
Version::from_str(&str)
.map_err(|_| anyhow!("Failed to parse Node.js version: '{}'", str))?,
),
..Default::default()
}))
}
#[turbo_tasks::function]
pub async fn current(process_env: ResolvedVc<Box<dyn ProcessEnv>>) -> Result<Vc<Self>> {
Ok(Self::cell(NodeJsEnvironment {
compile_target: CompileTarget::current().to_resolved().await?,
node_version: NodeJsVersion::cell(NodeJsVersion::Current(process_env))
.to_resolved()
.await?,
cwd: ResolvedVc::cell(None),
}))
}
}
#[turbo_tasks::value(shared)]View on GitHub (pinned to 0ae8c72462)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Confirm a parseable Node version before building.
const { execSync } = require('child_process')
const v = execSync('node --version').toString().trim() // e.g. v20.11.0
if (!/^v?\d+\.\d+\.\d+/.test(v)) {
throw new Error(`Unparseable Node.js version: '${v}'`)
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Node.js version parse error
- Default export is missing in {resource_path}
- Attempted to call the default export of {server_module_path}
- Attempted to call {export_name}() from the server but {expor
- NEXT_EVAL_TARBALL not set. Run evals via `pnpm eval` from th
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/8dfc9703ea17575d.
Report an issue: GitHub.