Merge pull request #1676 from Quadric/fix-node-version-in-install-script

`install.sh`: Fix a bug that block that installation of node in install.sh
Jordan Harband 2017-12-03 11:47:39 -08:00 committed by GitHub
commit 8a8dcbb393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 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
} }

View File

@ -0,0 +1,8 @@
#!/bin/sh
die () { echo "$@" ; exit 1; }
NODE_VERSION=8 \. ../../install.sh
# nvm installed node 8
nvm ls 8 > /dev/null 2>&1 || die "nvm didn't install node 8"