{"record":{"id":"dedd8a4046e8fbba","repo":"coreybutler/nvm-windows","slug":"no-versions-of-node-js-found-try-installing-the-l","errorCode":null,"errorMessage":"No versions of node.js found. Try installing the latest by typing nvm install latest.","messagePattern":"No versions of node\\.js found\\. Try installing the latest by typing nvm install latest\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/nvm.go","lineNumber":356,"sourceCode":"\n\tif version == \"\" {\n\t\treturn \"\", cpuarch, errors.New(\"A version argument is required but missing.\")\n\t}\n\n\t// If user specifies \"latest\" version, find out what version is\n\tif version == \"latest\" || version == \"node\" {\n\t\tversion = getLatest()\n\t\tfmt.Println(version)\n\t}\n\n\tif version == \"lts\" {\n\t\tversion = getLTS()\n\t}\n\n\tif version == \"newest\" {\n\t\tinstalled := node.GetInstalled(env.root)\n\t\tif len(installed) == 0 {\n\t\t\treturn version, \"\", errors.New(\"No versions of node.js found. Try installing the latest by typing nvm install latest.\")\n\t\t}\n\n\t\tversion = installed[0]\n\t}\n\n\tif version == \"32\" || version == \"64\" || version == \"arm64\" {\n\t\tcpuarch = version\n\t\tv, _ := node.GetCurrentVersion()\n\t\tversion = v\n\t}\n\n\tversion = versionNumberFrom(version)\n\tv, err := semver.Make(version)\n\tif err == nil {\n\t\terr = v.Validate()\n\t}\n\n\tif err == nil {","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/coreybutler/nvm-windows/blob/5b18223ca19ff50d707f35410dbc6bd440a9f74d/src/nvm.go#L338-L374","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Run `nvm install latest` (as the message suggests) then retry `nvm use newest`.","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.","If NVM_HOME is wrong after a reinstall, re-run the installer or update the env vars and restart the shell."],"exampleFix":"# before\nnvm use newest   # fresh machine\n# after\nnvm install latest\nnvm use newest","handlingStrategy":"validation","validationCode":"# bash: guard the 'newest' alias\nif [ \"$1\" = \"newest\" ] && [ -z \"$(ls \"$NVM_HOME\" 2>/dev/null | grep -E '^v[0-9]+\\.[0-9]+\\.[0-9]+$')\" ]; then\n  echo \"no versions installed; installing latest first\" >&2\n  nvm install latest\nfi\nnvm use newest","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use 'newest' on a fresh machine — install latest first.","Provision scripts with `nvm install <pinned-version>` instead of 'newest'.","Verify NVM_HOME points at the directory that actually holds your v* folders."],"tags":["nvm-windows","no-installed-versions","alias","environment"],"backgroundTag":null,"analyzedSha":"5b18223ca19ff50d707f35410dbc6bd440a9f74d","analyzedAt":"2026-08-15T10:06:51.428Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}