From 8f67e9839db57e5039258b8ef7ec5f90465eb4da Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 10 Mar 2023 13:38:59 +1100 Subject: [PATCH] Apply code suggestion Avoids an error: ./script/nodenv-install.sh: line 13: brew: command not found Co-authored-by: Maikel --- script/nodenv-install.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script/nodenv-install.sh b/script/nodenv-install.sh index f5d5f8cd28..37081b6d7d 100755 --- a/script/nodenv-install.sh +++ b/script/nodenv-install.sh @@ -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