Repository navigation
Fix a bug that block that installation of node in install.sh - #1676
Merged
Merged
Conversation
added 3 commits
November 30, 2017 14:47
ljharb
added a commit
to ljharb/nvm
that referenced
this pull request
Dec 9, 2017
Fixes - fix unassigned variable (nvm-sh#1665, nvm-sh#1664) - Fix for $path used by zsh (nvm-sh#1669) - `set -u`: ensure `NVM_USE_OUTPUT` is always set (nvm-sh#1671) - `install.sh`: Fix a bug that block that installation of node in install.sh (nvm-sh#1676) - `nvm install-latest-npm`: fix node 4-4.6 Documentation - Make `nvm cache clear` message less ambiguous (nvm-sh#1644) - Added missing piece (nvm-sh#1658)
edwmurph
pushed a commit
to edwmurph/nvm
that referenced
this pull request
Apr 9, 2018
…ll-script `install.sh`: Fix a bug that block that installation of node in install.sh
edwmurph
pushed a commit
to edwmurph/nvm
that referenced
this pull request
Apr 9, 2018
Fixes - fix unassigned variable (nvm-sh#1665, nvm-sh#1664) - Fix for $path used by zsh (nvm-sh#1669) - `set -u`: ensure `NVM_USE_OUTPUT` is always set (nvm-sh#1671) - `install.sh`: Fix a bug that block that installation of node in install.sh (nvm-sh#1676) - `nvm install-latest-npm`: fix node 4-4.6 Documentation - Make `nvm cache clear` message less ambiguous (nvm-sh#1644) - Added missing piece (nvm-sh#1658)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_nodefunction, 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_nodein 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 | bashExpected result: nvm should install node 8
Result: node 8 doesn't get installed
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 12492 100 12492 0 0 68946 0 --:--:-- --:--:-- --:--:-- 69016 => nvm is already installed in /home/ubuntu/.nvm, trying to update using git => => Compressing and cleaning up git repository => nvm source string already in /home/ubuntu/.bashrc => bash_completion source string already in /home/ubuntu/.bashrc => Close and reopen your terminal to start using nvm or run the following to use it now: export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completionexport NODE_VERSION=8 && sudo curl -o- https://raw.githubusercontent.com/Quadric/nvm/fix-node-version-in-install-script/install.sh | bashResult: node 8 is installed
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 12540 100 12540 0 0 48598 0 --:--:-- --:--:-- --:--:-- 48604 => nvm is already installed in /home/ubuntu/.nvm, trying to update using git => => Compressing and cleaning up git repository => nvm source string already in /home/ubuntu/.bashrc => bash_completion source string already in /home/ubuntu/.bashrc => Installing Node.js version 8 v8.9.1 is already installed. Now using node v8.9.1 (npm v5.5.1) => Node.js version 8 has been successfully installed => Close and reopen your terminal to start using nvm or run the following to use it now: export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completionI 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 :) 👍