diff --git a/scripts/packager.sh b/scripts/packager.sh index acb15812578..c149c751a55 100755 --- a/scripts/packager.sh +++ b/scripts/packager.sh @@ -8,14 +8,14 @@ THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) REACT_NATIVE_ROOT="$THIS_DIR/.." # Application root directory - General use case: react-native is a dependency -PROJECT_ROOT="$THIS_DIR/../../.." +PROJECT_ROOT=${PROJECT_ROOT:-"$THIS_DIR/../../.."} # check and assign NODE_BINARY env # shellcheck disable=SC1090 source "${THIS_DIR}/node-binary.sh" # When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT -if [ ! -d "$PROJECT_ROOT/node_modules/react-native" ]; +if [ ! -d "$THIS_DIR/../../../node_modules/react-native" ]; then PROJECT_ROOT="$THIS_DIR/.." fi