coreybutler/nvm-windows · error
A version argument is required but missing.
Error message
A version argument is required but missing.
What it means
Returned by getVersion() when the version argument is the empty string. The function resolves the arch first, then hard-fails because there is no version to resolve. It is a pure argument-validation error, not an environment problem.
Source
Thrown at src/nvm.go:340
func getVersion(version string, cpuarch string, localInstallsOnly ...bool) (string, string, error) {
requestedVersion := version
cpuarch = strings.ToLower(cpuarch)
if cpuarch != "" {
if cpuarch != "32" && cpuarch != "64" && cpuarch != "arm64" && cpuarch != "all" {
return version, cpuarch, errors.New("\"" + cpuarch + "\" is not a valid CPU architecture. Must be 32, 64, or arm64.")
}
} else {
cpuarch = env.arch
}
if cpuarch != "all" {
cpuarch = arch.Validate(cpuarch)
}
if version == "" {
return "", cpuarch, errors.New("A version argument is required but missing.")
}
// If user specifies "latest" version, find out what version is
if version == "latest" || version == "node" {
version = getLatest()
fmt.Println(version)
}
if version == "lts" {
version = getLTS()
}
if version == "newest" {
installed := node.GetInstalled(env.root)
if len(installed) == 0 {
return version, "", errors.New("No versions of node.js found. Try installing the latest by typing nvm install latest.")
}
View on GitHub (pinned to 5b18223ca1)
Solutions
- Supply an explicit version, or the aliases "latest", "node", "lts", "newest" (e.g. `nvm install latest`).
- In scripts, default the variable: `nvm install "${NODE_VERSION:-latest}".
- If you expected .nvmrc support, read the version yourself and pass it: `nvm install $(cat .nvmrc)` (strip the leading 'v').
Example fix
# before nvm install # after nvm install latest
Defensive patterns
Strategy: validation
Validate before calling
# bash: require or default a version before calling nvm
VERSION="${NODE_VERSION:-latest}"
[ -n "$VERSION" ] || { echo "NODE_VERSION is empty" >&2; exit 1; }
nvm install "$VERSION" Prevention
- Always pass an explicit version or the latest/lts/newest aliases.
- Set -u / null-check version variables in CI scripts before expanding them into nvm commands.
- Remember nvm-windows does not read .nvmrc; read it yourself and pass the value.
When it happens
Trigger: Invoking an install/use style command with no version operand (e.g. `nvm install` or `nvm use`) so the command dispatcher calls getVersion("", arch). Also a wrapper script that builds `nvm use $NODE_VER` with an unset/empty variable.
Common situations: CI pipelines where the version env var is not exported; users expecting bare `nvm install` to behave like Unix nvm's `.nvmrc` support (nvm-windows has none); quoting mistakes that expand to an empty string.
Related errors
- "%s" is not a valid CPU architecture. Must be 32, 64, or arm
- Unrecognized version: "%s"
- "%s" is not a valid version. Please use a valid semantic ver
- Did you mean node v%s (%v-bit)? If so, type "nvm use %s %v"
- Version not installed. Run "nvm ls" to see available version
AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15).
Data as JSON: /api/errors/5bf7951a5f7407f5.
Report an issue: GitHub.