coreybutler / nvm-windows

A node.js version management utility for Windows. Ironically written in Go.
MIT License
37.87k stars 3.35k forks source link

Bad arch detection #203

Open ZebraFlesh opened 8 years ago

ZebraFlesh commented 8 years ago

If this is a question about how to use NVM4W, please use stackoverflow instead.

If this is an issue regarding antivirus, make sure you search the existing issues first.

My Environment

nvm prints help indicating that nvm install "defaults to system arch". I'm running a 32-bit OS so I expected it to download a 32-bit version of node.

Actual Behavior

nvm is installing 64-bit versions of node, likely due to the fact that Windows is a guest OS in a virtual container.

Steps to reproduce the problem:

1) On a 64-bit OS (such as OS X), grab an IE 11 on Win 8.1 virtual machine from https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ (this seems to always come as a 32-bit OS; there's no architecture selection) 2) Install the VM in the container of your choice (I've tried both VMWare and VirtualBox) 3) Boot up the VM, verify it's a 32-bit instance (System Properties as well as wmic OS get OSArchitecture from the command prompt) 4) Install nvm-windows 1.1.1 5) Refresh $PATH as necessary 6) Execute nvm arch and receive the output: System Default: 64-bit. Currently Configured: -bit. 7) Execute nvm install 4.4.0 followed by nvm use 4.4.0: node 4.4.0 (64-bit) downloads and installs without issue 8) Execute node -v and see the message This version of C:\Program Files\nodejs\node.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

Work around: explicitly specify arch during installation: nvm install 4.4.0 32. Likely adding the arch to the settings.txt file would also work, but I didn't try that.

coreybutler commented 8 years ago

nvm arch 32 should set the default for you.

I'll have to look at why it's not autodetecting this. Is your settings file showing 64-bit architecture? I suspect it is, and I suspect the installer is to blame in this case.

I won't have time to look into this for a little while. If someone else does, the test to perform is building from source on a clean 32-bit system as opposed to using the installer. If it properly shows 32-bit when built from source, it signifies the problem is in the installer. Otherwise, it's in the code base.

ZebraFlesh commented 8 years ago

The settings file does not contain an arch setting.

coreybutler commented 8 years ago

Hm. Is arch even listed, or is it just blank?

ZebraFlesh commented 8 years ago

It was not even listed

espoelstra commented 8 years ago

I'll have to look at how nvm4w is determining the OS bitness, but if it was looking at the CPU capabilities I would definitely expect to see this more on 32 bit machines running on a 64 bit capable system.

alshain commented 7 years ago

I'm experiencing the exact same issue on Windows 7 32bit with a 64 bit CPU. Unlike @espoelstra 's install, this is a native installation, not virtualized.