fix: Resolve NODE_BINARY *after* finding the path to node (#32029)

Summary:
We want to resolve `NODE_BINARY` **after** `find-node.sh` runs and sets up any node version manager that we need to setup, otherwise `NODE_BINARY` is always undefined.

## Changelog

[Internal] [Fixed] - Resolve NODE_BINARY after finding the right path to node

Pull Request resolved: https://github.com/facebook/react-native/pull/32029

Reviewed By: TheSavior

Differential Revision: D30401213

Pulled By: yungsters

fbshipit-source-id: 386ffeff15b5f371a452488ed078d3adebe0f211
This commit is contained in:
pera
2021-08-19 11:35:06 +01:00
committed by Lorenzo Sciandra
parent 8b430e00d8
commit fde90a8020
+2 -1
View File
@@ -27,13 +27,14 @@ set -e
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
TEMP_DIR=$(mktemp -d /tmp/react-native-codegen-XXXXXXXX)
RN_DIR=$(cd "$THIS_DIR/.." && pwd)
NODE_BINARY="${NODE_BINARY:-$(command -v node || true)}"
USE_FABRIC="${USE_FABRIC:-0}"
# Find path to Node
# shellcheck source=/dev/null
source "$RN_DIR/scripts/find-node.sh"
NODE_BINARY="${NODE_BINARY:-$(command -v node || true)}"
cleanup () {
set +e
rm -rf "$TEMP_DIR"