Fix nvm_install_node function in install.sh script to not override the actual NODE_VERSION value

Ahmad Magdy 2017-11-30 14:47:42 +01:00
parent a57fe846e8
commit c7ac69bfbb
1 changed files with 8 additions and 8 deletions

View File

@ -140,22 +140,22 @@ install_nvm_from_git() {
# Automatically install Node.js # Automatically install Node.js
# #
nvm_install_node() { nvm_install_node() {
local NODE_VERSION local NODE_VERSION_LOCAL
NODE_VERSION="$(nvm_node_version)" NODE_VERSION_LOCAL="$(nvm_node_version)"
if [ -z "$NODE_VERSION" ]; then if [ -z "$NODE_VERSION_LOCAL" ]; then
return 0 return 0
fi fi
echo "=> Installing Node.js version $NODE_VERSION" echo "=> Installing Node.js version $NODE_VERSION_LOCAL"
nvm install "$NODE_VERSION" nvm install "$NODE_VERSION_LOCAL"
local CURRENT_NVM_NODE local CURRENT_NVM_NODE
CURRENT_NVM_NODE="$(nvm_version current)" CURRENT_NVM_NODE="$(nvm_version current)"
if [ "$(nvm_version "$NODE_VERSION")" == "$CURRENT_NVM_NODE" ]; then if [ "$(nvm_version "$NODE_VERSION_LOCAL")" == "$CURRENT_NVM_NODE" ]; then
echo "=> Node.js version $NODE_VERSION has been successfully installed" echo "=> Node.js version $NODE_VERSION_LOCAL has been successfully installed"
else else
echo >&2 "Failed to install Node.js $NODE_VERSION" echo >&2 "Failed to install Node.js $NODE_VERSION_LOCAL"
fi fi
} }