coreybutler/nvm-windows · error

No versions of node.js found. Try installing the latest by t

Error message

No versions of node.js found. Try installing the latest by typing nvm install latest.

What it means

Returned by getVersion() when the version alias "newest" is used but node.GetInstalled(env.root) reports zero installed versions. "newest" means 'highest locally installed version', so with an empty install directory there is nothing to select.

Source

Thrown at src/nvm.go:356

	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.")
		}

		version = installed[0]
	}

	if version == "32" || version == "64" || version == "arm64" {
		cpuarch = version
		v, _ := node.GetCurrentVersion()
		version = v
	}

	version = versionNumberFrom(version)
	v, err := semver.Make(version)
	if err == nil {
		err = v.Validate()
	}

	if err == nil {

View on GitHub (pinned to 5b18223ca1)

Solutions

  1. Run `nvm install latest` (as the message suggests) then retry `nvm use newest`.
  2. Run `nvm ls` (or `nvm list`) to confirm zero versions are visible; if you expected some, fix NVM_HOME / NVM_SYMLINK to point at the real root.
  3. If NVM_HOME is wrong after a reinstall, re-run the installer or update the env vars and restart the shell.

Example fix

# before
nvm use newest   # fresh machine
# after
nvm install latest
nvm use newest
Defensive patterns

Strategy: validation

Validate before calling

# bash: guard the 'newest' alias
if [ "$1" = "newest" ] && [ -z "$(ls "$NVM_HOME" 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$')" ]; then
  echo "no versions installed; installing latest first" >&2
  nvm install latest
fi
nvm use newest

Prevention

When it happens

Trigger: `nvm use newest` or `nvm install newest` on a machine where the nvm root (env.root, e.g. C:\Users\<you>\AppData\Roaming\nvm) contains no v* directories — fresh install, or root was wiped/moved.

Common situations: Fresh nvm-windows setup where the user tries to use a version before installing any; the NVM_HOME environment variable points at an empty/new directory after a reinstall; antivirus or a cleanup tool deleted the version directories.

Related errors


AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15). Data as JSON: /api/errors/dedd8a4046e8fbba. Report an issue: GitHub.