Skip to content

Commit

Permalink
Find node on m1 via homebrew node managers (#31678)
Browse files Browse the repository at this point in the history
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: #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 #31622

Reviewed By: ShikaSD

Differential Revision: D28967386

Pulled By: PeteTheHeat

fbshipit-source-id: 3d4a41dd3cc25fbf77778b16468a236b141d1259
  • Loading branch information
danilobuerger authored and facebook-github-bot committed Jun 8, 2021
1 parent eb30594 commit 4d40b53
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/find-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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

1 comment on commit 4d40b53

@oferRounds
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!
Even with this change, with M1, I still get the build error.
If I comment out the file, the build works

Any idea why that might be?

image

Please sign in to comment.