install-node: Correctly fix yarn installation.

Apparently, new versions of yarn use the HOME environment variable to
figure out where to access their configuration, and sudo apparently
doesn't clear that variable, so install-node was being run with HOME
set to something under /home/vagrant (e.g.).

Fix this by just setting that environment variable correctly.

This replaces 250a036ff8, which
misdiagnosed the issue.
This commit is contained in:
Tim Abbott 2018-04-12 11:34:34 -07:00
parent 205bcb8ef9
commit f6ae57fa70
1 changed files with 6 additions and 1 deletions

View File

@ -41,6 +41,11 @@ if [ "$current_node_version" != "v$node_version" ]; then
sed -i "s|NODE_PATH|$NODE_BIN|" /usr/local/bin/node sed -i "s|NODE_PATH|$NODE_BIN|" /usr/local/bin/node
fi fi
# Work around the fact that apparently sudo doesn't clear the HOME
# environment variable in some cases; we don't want root
# accessing/storing yarn configuration in the non-root user's home
# directory.
export HOME=/root
# Install yarn if not installed # Install yarn if not installed
bash "$ZULIP_PATH/scripts/lib/third/install-yarn.sh" "$ZULIP_SRV" --version "$yarn_version" bash "$ZULIP_PATH/scripts/lib/third/install-yarn.sh" "$ZULIP_SRV" --version "$yarn_version"
sudo chown -R "$(whoami)" "$HOME/.config/yarn"