hakobera/nvmw

Various architectures cannot coexist

Closed this issue · 3 comments

am11 commented

Problem:

# on x64 system

# Test 1:
nvmw install iojs-v1.2.0
nvmw use iojs-v1.2.0
iojs -p process.arch
# => x64

# Test 2:
# now install same version with x86 architecture:
nvmw install iojs-v1.2.0 x86
# you will probably notice that during the installation,
# it will ask to overwrite files when unzipping npm.zip..
nvmw use iojs-v1.2.0-x86
iojs -p process.arch
# => x64
# expected: x86

# Test 3:
# now install different version with x86 architecture
# whose x64 variant is not installed:
nvmw install iojs-v1.1.0 x86
nvmw use iojs-v1.1.0-x86
iojs -p process.arch
# => x86

Proposed solution:

  • Always save with architecture slug (-x86 or -x64), if the architecture is not provided in nvmw install on x64, still save with -x64 prefix.
  • On nvmw use, if -x64 or -x86 is provided, do not disregard it (see Test 2 and Test 3 in above example) and throw the error if the intended {runtime}-{version}-{architecture} is not installed.
  • If architecture suffix is not provided, append the system default architecture slug (-x64 on 64-bit OS).
am11 commented

A quick workaround is to download x64 variant (e.g. nvmw install v0.12.0), make a copy and append the original name with -x86 (%userprofile%\.nvmw\v0.12.0-x86), then download node.exe from http://nodejs.org/dist/v0.12.0/ (the one on the root folder is x86 and the one in x64/ is 64-bit) and overwrite the one in the copied folder (%userprofile%\.nvmw\v0.12.0-x86\node.exe).

This is almost the same workaround that works with nvm for Linux/Mac (as it also does not support x86 installation on x64). There you need to untar the wget'd tar.gz (e.g. tar -C ~/.nvm/versions/node -xvf node-v0.10.36-linux-x86.tar.gz and rename the directory to v0.12.0-x86). //cc @xzyfer

After that nvmw use v0.12.0-x86 (or nvm use v0.12.0) works like a champ!

Update:

For iojs workaround with nvmw, for example (iojs-v1.2.0), set x86 variant as iojs-v1.2.0x86 (without hyphen before x86). The responsible code is here: nvmw.bat#L90-L93, which ignores the following architecture token.

For iojs workaround with nvm, extract the downloaded achieve in ~/.nvm/versions/io.js and rename the directory.

I will fix this bug soon.

am11 commented

👍