mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
provision: Use NVM to install node and npm.
NVM takes a specific node version and installs the node package and a corresponding compatible npm package. We use it in a somewhat hackish way to install node/npm globally with a pinned version, since that's how we actually want to consume node in our development environment. Other details: - Travis CI now is configured to use the version of node installed by provision; the easiest way to do this was to sabotage the existing node installation. - jsdom is upgraded to a current version, which both requires recent node and also is required for the tests to pass with recent node. This fixes running the node tests on Xenial. Fixes #1498. [tweaked by tabbott]
This commit is contained in:
22
tools/setup/install-node
Executable file
22
tools/setup/install-node
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
ZULIP_PATH=$(dirname "$0")
|
||||
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"
|
||||
|
||||
# Fix messed-up uid=500 and group write bits produced by nvm
|
||||
n=$(which node)
|
||||
n=${n%/bin/node}
|
||||
chown -R root:root "$n"
|
||||
chmod -R go-w "$n"
|
||||
|
||||
# Install node and npm wrappers to /usr/local/bin
|
||||
cp "$ZULIP_PATH/../../scripts/setup/node-wrapper" /usr/local/bin/node
|
||||
cp "$ZULIP_PATH/../../scripts/setup/npm-wrapper" /usr/local/bin/npm
|
||||
Reference in New Issue
Block a user