Fix a bug that block that installation of node in install.sh #1676
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I found a bug in
nvm_install_node
function, it overrides the variable NODE_VERSION, which blocks the installation of node in the install.sh script! More details below..I did some tests locally with the install.sh script, and the I found that the problem in in the function
nvm_install_node
in install.sh script.One solution is to change the name of the local variable to something other than NODE_VERSION
You could test it using these 2 scripts:
I ran tests on ubuntu 16.04 servers
export NODE_VERSION=8 && sudo curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
Expected result: nvm should install node 8
Result: node 8 doesn't get installed
export NODE_VERSION=8 && sudo curl -o- https://raw.githubusercontent.com/Quadric/nvm/fix-node-version-in-install-script/install.sh | bash
Result: node 8 is installed
I wrote a test for it, and ran "test/install_script" on original repo and my fix, and surprisingly the test passes on both!! (https://github.com/Quadric/nvm/blob/fix-node-version-in-install-script/test/install_script/nvm_install_with_node_version), it doesn't change the fact that it still fails when I provision an AWS AMI with packer or when I run the script directly on the newly created machine!
thanks for you efforts :) 👍