From c52dbd57f51a782da7d002278fd04f5eaebef56a Mon Sep 17 00:00:00 2001 From: sinwar Date: Mon, 12 Jun 2017 21:35:02 +0530 Subject: [PATCH] provision: Avoid spending 2s reinstalling node/npm. Tweaked by tabbott to just check the versions. Fixes #5184. --- scripts/lib/install-node | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/lib/install-node b/scripts/lib/install-node index bee30fe311..167224dc96 100755 --- a/scripts/lib/install-node +++ b/scripts/lib/install-node @@ -2,13 +2,24 @@ set -e ZULIP_PATH=$(dirname "$0") +ZULIP_ROOT=$(realpath "$ZULIP_PATH/../..") +node_version=6.6.0 +npm_version=3.10.3 + +current_node_version=$(node --version) +current_npm_version=$(npm --version) + +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." + exit 0 +fi + export NVM_DIR=/usr/local/nvm if ! [ -e "$NVM_DIR/nvm.sh" ]; then wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash fi source "$NVM_DIR/nvm.sh" -node_version=6.6.0 nvm install "$node_version" && nvm alias default "$node_version" export NODE_BIN="$(nvm which default)" export NPM_BIN=$(echo "$NODE_BIN" | sed 's/node$/npm/')