diff --git a/react.gradle b/react.gradle index 04b94aad9ee513..84b1f60df6e7b7 100644 --- a/react.gradle +++ b/react.gradle @@ -28,17 +28,11 @@ def detectCliPath(config) { if (config.cliPath) { return config.cliPath } - - def cliPath = ["node", "-e", "console.log(require('react-native/cli').bin);"].execute([], projectDir).text.trim() - - if (cliPath) { - return cliPath - } else if (new File("${projectDir}/../../node_modules/react-native/cli.js").exists()) { + if (new File("${projectDir}/../../node_modules/react-native/cli.js").exists()) { return "${projectDir}/../../node_modules/react-native/cli.js" - } else { - throw new Exception("Couldn't determine CLI location. " + - "Please set `project.ext.react.cliPath` to the path of the react-native cli.js"); } + throw new Exception("Couldn't determine CLI location. " + + "Please set `project.ext.react.cliPath` to the path of the react-native cli.js"); } def composeSourceMapsPath = config.composeSourceMapsPath ?: "node_modules/react-native/scripts/compose-source-maps.js" diff --git a/scripts/find-node.sh b/scripts/find-node.sh index 0d0a155b238bfe..c972be576fe152 100755 --- a/scripts/find-node.sh +++ b/scripts/find-node.sh @@ -31,3 +31,9 @@ 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