From 9bee6e77e40a422f4e6d10f23ca3ab518f572f7b Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Thu, 2 Jan 2025 12:10:47 +0100 Subject: [PATCH] Don't perform any changes when trying to use current node version --- src/nvm.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/nvm.go b/src/nvm.go index eeaa7022..7a442222 100644 --- a/src/nvm.go +++ b/src/nvm.go @@ -1154,6 +1154,14 @@ func use(version string, cpuarch string, reload ...bool) { } } + // Check if a change is needed + curVersion, curCpuarch := node.GetCurrentVersion() + if version == curVersion && cpuarch == curCpuarch { + fmt.Println("node v" + version + " (" + cpuarch + "-bit) is already in use.") + status <- Status{Done: true} + return + } + // Make sure the version is installed. If not, warn. if !node.IsVersionInstalled(env.root, version, cpuarch) { err = fmt.Errorf("node v%s (%v-bit) is not installed.", version, cpuarch)