install-node: Fix provisioning when node/npm don't exist.

Our recent performance changes to this script broke it in the case
where there was no previous version of node/npm installed.
This commit is contained in:
Tim Abbott
2017-07-11 12:36:33 -07:00
parent 0c4165a5bd
commit f724900e68

View File

@@ -5,7 +5,16 @@ ZULIP_PATH=$(dirname "$0")
node_version=6.6.0 node_version=6.6.0
npm_version=3.10.3 npm_version=3.10.3
if [ "$(npm --version)" = "$npm_version" ] && [ "$(node --version)" = "v$node_version" ]; then current_npm_version="none"
if hash npm 2>/dev/null; then
current_npm_version="$(npm --version)"
fi
current_node_version="none"
if hash node 2>/dev/null; then
current_node_version="$(node --version)"
fi
if [ "$current_npm_version" = "$npm_version" ] && [ "$current_node_version" = "v$node_version" ]; then
echo "Node version $node_version and npm version $npm_version are already installed." echo "Node version $node_version and npm version $npm_version are already installed."
exit 0 exit 0
fi fi