Apply code suggestion

Avoids an error:
./script/nodenv-install.sh: line 13: brew: command not found

Co-authored-by: Maikel <maikel@email.org.au>
This commit is contained in:
David Cook
2023-03-10 13:38:59 +11:00
committed by GitHub
parent d377300f32
commit 8f67e9839d

View File

@@ -9,8 +9,13 @@ if nodenv install --skip-existing; then
echo "Correct Node version is installed."
else
echo "Upgrading node-build:"
# If homebrew (macOS) installed, try that first. Otherwise look in plugins directory.
brew upgrade node-build || git -C "$(nodenv root)"/plugins/node-build pull
if command -v brew &> /dev/null; then
# Installation via Homebrew is recommended on macOS.
brew upgrade node-build
else
git -C "$(nodenv root)"/plugins/node-build pull
fi
nodenv install
fi