From afdd16f640a5e91016138097a60d80cedb81c712 Mon Sep 17 00:00:00 2001 From: coreybutler <770982+coreybutler@users.noreply.github.com> Date: Mon, 16 Nov 2026 12:02:08 -0600 Subject: [PATCH] fix(use): resolve --local alpha via LatestInstalledAlpha Wire nvm use alpha --local to alpha-only installed tags so it never selects GA/rc. Partial prefer-stable lives in common (061811e). Signed-off-by: Corey Butler <770982+coreybutler@users.noreply.github.com> --- src/commands/use/version.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/commands/use/version.go b/src/commands/use/version.go index 1f19616..5345978 100644 --- a/src/commands/use/version.go +++ b/src/commands/use/version.go @@ -16,7 +16,7 @@ type Version struct { constant.FlagInstall constant.FlagNoInstall Version []string `arg:"" name:"version" optional:"" help:"Node.js version to activate (e.g. latest, lts, x.x.x)."` - Local bool `flag:"local" short:"l" help:"Use the latest installed version matching the specified partial version."` + Local bool `flag:"local" short:"l" help:"Use the latest installed match (partial majors prefer GA over prerelease; alpha is alpha-only)."` } func getStringSetting(name string) (string, error) { @@ -69,7 +69,14 @@ func (s *Version) Run() error { // --local: resolve to the best installed match without touching the network. if s.Local { - matched, ok := resolver.LatestInstalledMatch(requestedVersion) + var matched string + var ok bool + if strings.EqualFold(strings.TrimSpace(requestedVersion), "alpha") { + // alpha is restricted to -alpha installs (never GA/rc). + matched, ok = resolver.LatestInstalledAlpha() + } else { + matched, ok = resolver.LatestInstalledMatch(requestedVersion) + } if !ok { return fmt.Errorf("v%s is not installed", formatNotInstalledVersion(requestedVersion)) }