mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
install-node: bypass nvm wrapper for faster node startup.
This fixes a significant performance issue with LaTeX rendering (and other things that invoked node) where starting up node took a few hundred milliseconds due to nvm initialization. Tweaked by tabbott to avoid copying the node binary itself, instead using a tiny wrapper script. This is important primarily because it's possible a future version of node will expect to find libraries/dependencies/etc. installed via NVM at some path related to the path of the node binary itself, and that's more guaranteed with this new model. Fixes #4618.
This commit is contained in:
@@ -10,6 +10,7 @@ fi
|
|||||||
source "$NVM_DIR/nvm.sh"
|
source "$NVM_DIR/nvm.sh"
|
||||||
node_version=6.6.0
|
node_version=6.6.0
|
||||||
nvm install "$node_version" && nvm alias default "$node_version"
|
nvm install "$node_version" && nvm alias default "$node_version"
|
||||||
|
export NODE_BIN="$(nvm which default)"
|
||||||
|
|
||||||
# Fix messed-up uid=500 and group write bits produced by nvm
|
# Fix messed-up uid=500 and group write bits produced by nvm
|
||||||
n=$(which node)
|
n=$(which node)
|
||||||
@@ -19,4 +20,5 @@ chmod -R go-w "$n"
|
|||||||
|
|
||||||
# Install node and npm wrappers to /usr/local/bin
|
# 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/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
|
cp "$ZULIP_PATH/../../scripts/setup/npm-wrapper" /usr/local/bin/npm
|
||||||
|
|||||||
@@ -1,4 +1,2 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export NVM_DIR="/usr/local/nvm"
|
NODE_PATH "$@"
|
||||||
[ -e "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
||||||
node "$@"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user