coreybutler/nvm-windows · error
"%s" is not a valid version. Please use a valid semantic ver
Error message
"%s" is not a valid version. Please use a valid semantic version number, "lts", or "latest".
What it means
Sent on the install status channel when getVersion()/semver resolution left err non-nil after all rescue paths (invalid version and not a "No Major.Minor.Patch" case). It is the generic 'not a valid version' terminal message, echoing requestedVersion and telling the user the accepted forms: semantic version, lts, or latest.
Source
Thrown at src/nvm.go:648
sverr = sv.Validate()
}
if sverr != nil {
version = findLatestSubVersion(version)
if len(version) == 0 {
sverr = errors.New("Unrecognized version: \"" + requestedVersion + "\"")
}
}
err = sverr
}
if err != nil {
status <- Status{Err: err, Help: true}
return
}
}
if err != nil {
status <- Status{Err: fmt.Errorf(`"%s" is not a valid version.`+"\n"+`Please use a valid semantic version number, "lts", or "latest".`, requestedVersion)}
return
}
if checkVersionExceedsLatest(version) {
status <- Status{Err: fmt.Errorf("Node.js v%s is not yet released or is not available for download yet.", version)}
return
}
if cpuarch == "64" && !web.IsNode64bitAvailable(version) {
status <- Status{Err: fmt.Errorf("Node.js v%s is only available in 32-bit.", version)}
return
}
// Check to see if the version is already installed
if !node.IsVersionInstalled(env.root, version, cpuarch) {
if !node.IsVersionAvailable(version) {
url := web.GetFullNodeUrl("index.json")
status <- Status{Err: fmt.Errorf("Version %s is not available.\n\nThe complete list of available versions can be found at %s", version, url)}View on GitHub (pinned to 5b18223ca1)
Solutions
- Use an exact released version from `nvm ls available`, e.g. `nvm install 20.11.0`.
- Use `latest` or `lts` aliases.
- Strip whitespace/quotes/CR characters from scripted version strings: `nvm install $(printf '%s' "$V" | tr -d '[:space:]')`.
- For prerelease builds, install manually by unzipping into <NVM_HOME>\v<version>.
Example fix
# before nvm install " 20.11.0 " # after nvm install 20.11.0
Defensive patterns
Strategy: validation
Validate before calling
# bash: trim whitespace/CR and validate shape before install V=$(printf '%s' "$NODE_VERSION" | tr -d '[:space:]') case "$V" in latest|lts|*[0-9].[0-9].[0-9]*) nvm install "$V" ;; *) echo "bad version: $V" >&2; exit 1 ;; esac
Prevention
- Strip whitespace and CR from scripted version strings (affects Windows CRLF files).
- Avoid prerelease tags; nvm-windows only installs official index versions.
- Validate the token shape before passing it so the CLI help path never triggers.
When it happens
Trigger: `nvm install 20.11` where the partial-version lookup path errored in a way other than 'No Major.Minor.Patch'; malformed input like `nvm install v20.11.0-beta` where the prerelease tag fails this build's semver handling; or an empty/garbage string that slips past earlier checks.
Common situations: Prerelease/tagged versions (e.g. `-nightly`, custom builds); scripts concatenating extra characters onto the version; users pasting versions from blog posts with invisible whitespace.
Related errors
- "%s" is not a valid CPU architecture. Must be 32, 64, or arm
- A version argument is required but missing.
- Unrecognized version: "%s"
- Node.js v%s is only available in 32-bit and 64-bit.
- Version %s is not available. The complete list of available
AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15).
Data as JSON: /api/errors/48c2181745312ce2.
Report an issue: GitHub.