diff --git a/scripts/lib/install-node b/scripts/lib/install-node index 2597b211ea..14c3335c5b 100755 --- a/scripts/lib/install-node +++ b/scripts/lib/install-node @@ -10,6 +10,11 @@ YARN_BIN="$ZULIP_SRV/zulip-yarn/bin/yarn" node_version=8.11.1 yarn_version=1.5.1 +# This is a fix for the fact that nvm uses $HOME to determine which +# user account's home directory to ~/.config to. Ideally, we'd have a +# more systematic fix, like using `sudo -H` everywhere. +export HOME=/root + current_node_version="none" if hash node 2>/dev/null; then current_node_version="$(node --version)" diff --git a/tools/lib/provision.py b/tools/lib/provision.py index be5c6fe202..48f33caaed 100755 --- a/tools/lib/provision.py +++ b/tools/lib/provision.py @@ -248,7 +248,7 @@ def main(options): print("No changes to apt dependencies, so skipping apt operations.") # Here we install node. - run(["sudo", "scripts/lib/install-node"]) + run(["sudo", "-H", "scripts/lib/install-node"]) # This is a wrapper around `yarn`, which we run last since # it can often fail due to network issues beyond our control.