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
commit
8a8dcbb393
16
install.sh
16
install.sh
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"
|
Loading…
Reference in New Issue