nvm-windows icon indicating copy to clipboard operation
nvm-windows copied to clipboard

"$ nvm install 5" does unexpected thing

Open ORESoftware opened this issue 8 years ago • 15 comments

My Environment

  • [ ] Windows 7 or below (not truly supported due to EOL)
  • [ ] Windows 8
  • [ ] Windows 8.1
  • [x] Windows 10
  • [ ] Windows 10 IoT Core
  • [ ] Windows Server 2012
  • [ ] Windows Server 2012 R2
  • [ ] Windows Server 2016
  • [ ] My Windows installation is non-English.

I have already...

  • [ ] read the README to be aware of npm gotchas & antivirus issues.
  • [ ] reviewed the wiki to make sure my issue hasn't already been resolved.
  • [ ] verified I'm using an account with administrative privileges.
  • [ ] searched the issues (open and closed) to make sure this isn't a duplicate.
  • [ ] made sure this isn't a question about how to use NVM for Windows, since gitter is used for questions and comments.

My issue is related to (check only those which apply):

  • [ ] settings.txt
  • [ ] proxy support
  • [ ] 32 or 64 bit support

Expected Behavior

nvm install 5

would install latest version (whatever it was)

Actual Behavior


C:\Users\denman\WebstormProjects\suman>nvm install 5
panic: runtime error: index out of range

goroutine 1 [running]: /C/Users/Corey/Documents/workspace/nvm-windows/src/nvm/web.IsNode64bitAvailable(0x12226134, 0x1, 0x674700) C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm/web/web.go:153 +0x157 main.install(0x12226134, 0x1, 0x674700, 0x2) C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm.go:171 +0x484 main.main() C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm.go:65 +0x64e

Steps to reproduce the problem:

just run

$ nvm install 5

thanks, this is working for me so far! just wanted to let you know that I expected that command to work. Cheers!

ORESoftware avatar Mar 16 '16 03:03 ORESoftware

Thanks for the feedback. While this isn't a bug, I appreciate knowing this is the behavior you were expecting. I've marked it as an enhancement request.

coreybutler avatar Mar 16 '16 20:03 coreybutler

np, sounds good!

ORESoftware avatar Mar 16 '16 21:03 ORESoftware

Looks like we must to tell nvm exact version we want it to install. nvm install 4 will fail with similar errors, but nvm install 4.4.4 will install 4.4.4 version of node...

Why not tell it in Error like unknown version or smth else...

KoteKotlyarov avatar May 21 '16 22:05 KoteKotlyarov

This is actually more important than facilitating convenience. It is needed on CI servers to ensure the latest version is installed. Otherwise I must update our CI configuration every time Node releases a patch.

jamestalmage avatar May 26 '16 21:05 jamestalmage

@jamestalmage - So support for nvm install latest has been around for awhile.

I just released a new version. I don't think it behaves exactly as desired, but it won't error out on something like nvm install 6. Instead, it fills in the minor and patch versions automatically. So, nvm install 6 would install version 6.0.0.

Since this doesn't address the enhancement request in it's entirety, I'm going to leave this open.

coreybutler avatar Jul 02 '16 01:07 coreybutler

Can this feature request also cover nvm use?

That's the command I use the most and it'd be much more convenient to do nvm use 4 to use latest 4.x version I have installed, rather than having to nvm list first to check.

insin avatar Jul 26 '16 08:07 insin

@insin - Yeah, nvm use should pretty much always mirror nvm install syntax. When I get around to implementing this, it should be in both.

coreybutler avatar Jul 26 '16 14:07 coreybutler

@coreybutler if I remember correctly, UNIX nvm install 6 installs the latest version of Node 6, not 6.0.0. That caught me off guard.

jedwards1211 avatar Sep 13 '16 20:09 jedwards1211

Some other aliases would also be useful, like unix nvm or node's oficial docker image

nvm install lts -> installs latests lts version nvm install boron -> installs latest boron version And as stated before nvm install 6 -> installs ^6.x.x semver style

sandman21dan avatar Mar 29 '17 10:03 sandman21dan

I'm gonna sort of weigh in here(I hope this is the right place for it) and say that I tried to do nvm install 8 which got me:

goroutine 1 [running]:
_/C_/Users/Corey/Documents/workspace/nvm-windows/src/nvm/web.IsNode64bitAvailable(0x1104a0dc, 0x1,     0x674700)
        C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm/web/web.go:153 +0x157
main.install(0x1104a0dc, 0x1, 0x674700, 0x2)
        C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm.go:171 +0x484
main.main()
        C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm.go:65 +0x64e

The paths there referring to Corey look like they might be hard coded somewhere?

robertmain avatar May 31 '17 00:05 robertmain

According to this @jedwards1211 is correct. Is there any way we can get feature parity with the Linux/Mac version? We want to use nvm for builds across platforms and are unable to due to inconsistencies in nvm.

stephenmichaelf avatar Jan 05 '18 19:01 stephenmichaelf

@stephenmichaelf This particular feature will likely be in parity with nvm in an upcoming release, but there are different philosophies about version management. NVM4W is more in line with n than nvm, so there probably won't be feature parity.

FWIW, NVM4W will be going through a naming change when I get the next major release done, primarily because it will work on all operating systems. I don't know when that will be right now (I have 7 client projects right now... and I'm hiring for anyone reading this)... but I have alot of work complete (been running it on my mac for several months).

coreybutler avatar Jan 06 '18 00:01 coreybutler

Hello @coreybutler, any hope it would be fixed? I've already created fresh issue #596 which describes current behavior, and some code research from @Serializator .

The current issue seems reporting the crash, but the current behavior is to just download x.0.0 for x >9 and pick the latest minor ver for x <10

Mart-Bogdan avatar Jan 04 '21 15:01 Mart-Bogdan

Ok, I see there are also two issues for mvn use

Hmm, I'm wondering is that the same code path? I think not, nvm use should consider only locally insntalled ones

Mart-Bogdan avatar Jan 04 '21 15:01 Mart-Bogdan

Any updates on this? It has been 5 years and I just started using NVM and I came to check why would I get Node 14.0.0 instead of latest if i specify only the Major?

ingles98 avatar Jun 15 '21 16:06 ingles98

It seems to work correctly now, at

nvm --version

Running version 1.1.9.

Mart-Bogdan avatar Sep 06 '22 20:09 Mart-Bogdan

So can be closed, I guess.

Mart-Bogdan avatar Sep 06 '22 20:09 Mart-Bogdan

Closing because this behavior does exist now. Issue #708 addresses partial version support, which already has a merged PR associated with.

coreybutler avatar Sep 07 '22 18:09 coreybutler