From 9cab9656010e4cfffed16fa8f0a9dc81cf47cd8e Mon Sep 17 00:00:00 2001 From: sinwar Date: Sat, 10 Jun 2017 11:46:47 +0530 Subject: [PATCH] install-node: hardcode the path for npm. This replaces nvm in npm-wrapper by harcoding the path the way we do with node. The main benefit is that this saves a few hundred milliseconds every time we invoke npm. --- scripts/lib/install-node | 2 ++ scripts/setup/npm-wrapper | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/lib/install-node b/scripts/lib/install-node index 2919d717a5..bee30fe311 100755 --- a/scripts/lib/install-node +++ b/scripts/lib/install-node @@ -11,6 +11,7 @@ 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/') # Fix messed-up uid=500 and group write bits produced by nvm n=$(which node) @@ -22,3 +23,4 @@ chmod -R go-w "$n" cp "$ZULIP_PATH/../../scripts/setup/node-wrapper" /usr/local/bin/node sed -i "s|NODE_PATH|$NODE_BIN|" /usr/local/bin/node cp "$ZULIP_PATH/../../scripts/setup/npm-wrapper" /usr/local/bin/npm +sed -i "s|NPM_PATH|$NPM_BIN|" /usr/local/bin/npm diff --git a/scripts/setup/npm-wrapper b/scripts/setup/npm-wrapper index 7b2395d97e..fbde4e3499 100755 --- a/scripts/setup/npm-wrapper +++ b/scripts/setup/npm-wrapper @@ -1,4 +1,2 @@ #!/bin/bash -export NVM_DIR="/usr/local/nvm" -[ -e "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" -npm "$@" +NPM_PATH "$@"