-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Fix: use NODE_BINARY when starting packager #24156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
[ -z "$NODE_BINARY" ] && export NODE_BINARY="node" | ||
|
||
nodejs_not_found() | ||
{ | ||
echo "error: Can't find the '$NODE_BINARY' binary to build the React Native bundle. " \ | ||
"If you have a non-standard Node.js installation, select your project in Xcode, find " \ | ||
"'Build Phases' - 'Bundle React Native code and images' and change NODE_BINARY to an " \ | ||
"absolute path to your node executable. You can find it by invoking 'which node' in the terminal." >&2 | ||
exit 2 | ||
} | ||
|
||
type "$NODE_BINARY" >/dev/null 2>&1 || nodejs_not_found |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,15 @@ PROJECT_ROOT="$THIS_DIR/../../.." | |
# shellcheck source=/dev/null | ||
source "${THIS_DIR}/.packager.env" | ||
|
||
# check and assign NODE_BINARY env | ||
# shellcheck disable=SC1091 | ||
source "${THIS_DIR}/node-binary.sh" | ||
Esemesek marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SC1090: (warning) Can't follow non-constant source. Use a directive to specify location. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SC1090: (warning) Can't follow non-constant source. Use a directive to specify location. |
||
|
||
# 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 "$REACT_NATIVE_ROOT/cli.js" start "$@" | ||
"$NODE_BINARY" "$REACT_NATIVE_ROOT/cli.js" start "$@" |
Uh oh!
There was an error while loading. Please reload this page.