From f6ae57fa704619287617f770dd3af505616b85e7 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 12 Apr 2018 11:34:34 -0700 Subject: [PATCH] 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 250a036ff832b9eceb52e00a3f815ca70aa10460, which misdiagnosed the issue. --- scripts/lib/install-node | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/lib/install-node b/scripts/lib/install-node index 609218c7cc..5e5557af80 100755 --- a/scripts/lib/install-node +++ b/scripts/lib/install-node @@ -41,6 +41,11 @@ if [ "$current_node_version" != "v$node_version" ]; then sed -i "s|NODE_PATH|$NODE_BIN|" /usr/local/bin/node 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 bash "$ZULIP_PATH/scripts/lib/third/install-yarn.sh" "$ZULIP_SRV" --version "$yarn_version" -sudo chown -R "$(whoami)" "$HOME/.config/yarn"