From 6b5b72c4c31529b9f17750d5d846fbe3033fe88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20B=C3=BCrger?= Date: Tue, 8 Jun 2021 11:18:36 -0700 Subject: [PATCH] Find node on m1 via homebrew node managers (#31678) Summary: Adds homebrew on m1 to path before evaluating `command -v brew` to support nvm on m1 via homebrew. ## Changelog [General] [Changed] - Find node on m1 via homebrew node managers Pull Request resolved: https://github.com/facebook/react-native/pull/31678 Test Plan: On M1, use nvm via homebrew. Create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed. cc: dulmandakh as discussed in https://github.com/facebook/react-native/pull/31622 Reviewed By: ShikaSD Differential Revision: D28967386 Pulled By: PeteTheHeat fbshipit-source-id: 3d4a41dd3cc25fbf77778b16468a236b141d1259 --- scripts/find-node.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/find-node.sh b/scripts/find-node.sh index c972be576fe152..c498ba617a29fe 100755 --- a/scripts/find-node.sh +++ b/scripts/find-node.sh @@ -6,6 +6,12 @@ set -e +# Support Homebrew on M1 +HOMEBREW_M1_BIN=/opt/homebrew/bin +if [[ -d $HOMEBREW_M1_BIN && ! $PATH =~ $HOMEBREW_M1_BIN ]]; then + export PATH="$HOMEBREW_M1_BIN:$PATH" +fi + # Define NVM_DIR and source the nvm.sh setup script [ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm" @@ -31,9 +37,3 @@ if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then eval "$(anyenv init -)" fi fi - -# Support Homebrew on M1 -HOMEBREW_M1_BIN=/opt/homebrew/bin -if [[ -d $HOMEBREW_M1_BIN && ! $PATH =~ $HOMEBREW_M1_BIN ]]; then - export PATH="$HOMEBREW_M1_BIN:$PATH" -fi