mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
698b14789c
Summary: `realpath` is not available on macOS 12.2 and 12.4. Because of this, the following error is shown when launching an RN app with XCode (which calls `packager.sh` via `launchPackage.command`): <img width="1123" alt="Screen Shot 2022-07-06 at 1 26 08 PM" src="https://user-images.githubusercontent.com/218725/177608681-0cf4dc5a-b71c-4ddc-8fbe-4d37b2d3e2cb.png"> I am running Bash 5 but realpath is also not available with zsh. This issue was introduced in https://github.com/facebook/react-native/commit/bb8ddd6c1247fde230a60c662a318422df52516e#diff-6ca7c99209bdf630550bb9e2946ce8611948c5a23b32ffb25028792ef5d48b8d, which interestingly did not change `launchPackage.command`. There's a recent comment on that commit that confirms this issue: https://github.com/facebook/react-native/commit/bb8ddd6c1247fde230a60c662a318422df52516e#commitcomment-77818917 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Use readlink instead of realpath in packager.sh Pull Request resolved: https://github.com/facebook/react-native/pull/34145 Reviewed By: cipolleschi Differential Revision: D37669417 Pulled By: cortinico fbshipit-source-id: bcc4cb6e886df059e6598ee811226e3cd1a6ae14
25 lines
928 B
Bash
Executable File
25 lines
928 B
Bash
Executable File
#!/bin/bash
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
# scripts directory
|
|
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/../../.."
|
|
|
|
# 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" ];
|
|
then
|
|
PROJECT_ROOT="$THIS_DIR/.."
|
|
fi
|
|
# Start packager from PROJECT_ROOT
|
|
cd "$PROJECT_ROOT" || exit
|
|
"$NODE_BINARY" "$REACT_NATIVE_ROOT/cli.js" start --custom-log-reporter-path "$THIS_DIR/packager-reporter.js" "$@"
|