Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvm use won't match major version number only to installed version #804

Closed
jcairney opened this issue May 12, 2022 · 1 comment
Closed

Comments

@jcairney
Copy link

jcairney commented May 12, 2022

Issue:

With the Linux version of nvm, one can do:

$ nvm install 15
. . .
Now using node v15.14.0 (npm v7.7.6)
$ nvm install 16
. . .
Now using node v16.15.0 (npm v8.5.5)
$ nvm use 15
Now using node v15.14.0 (npm v7.7.6)

On Windows, when you install a version it is not automatically selected. And when you use a version, it can't be referenced by just the major version number.

> nvm use 16.5.0
Now using node v16.15.0 (64-bit)
> nvm install 15
. . .
Installation complete. If you want to use this version, type

nvm use 15.14.0
> nvm current
v16.15.0
> nvm use 15
node vv15.14.0 (64-bit) is not installed or cannot be found.

However, specifying the full version number works as expected, following the install:

> nvm use 15.14.0
Now using node v15.14.0 (64-bit)

How To Reproduce:

Run the above commands in PowerShell.

Expected Behavior:

It would be nice if nvm switched to the version being installed. That's usually what people want to do when they install a new version.

But the main reason I came to file is that I expected when typing nvm use 15 that it would find v15.14.0 and use it. I get the impression this was the intended functionality (when I type 15, it tells me about 15.14.0 anyway) but it appears to be failing to match the major version number to an installed version, even though there is one (or more sometimes!) that should match.

  • OS: Windows 11
  • NVM: 1.1.9

Additional context:
I am using a utility called gsudo to elevate to administrator as I run the NVM commands. It is awkward to start PowerShell as administrator every time, and though I saw bug titles suggesting that NVM should raise UAC prompts, I find it doesn't, and both nvm install and nvm use fail without some form on intervention to make either the console or issued command run as administrator.
e.g.

> gsudo nvm use 15
node vv15.14.0 (64-bit) is not installed or cannot be found.
@coreybutler
Copy link
Owner

Duplicate of #708, already resolved in #709.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants