File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed
local-cli/generator-ios/templates/xcodeproj Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 525525 );
526526 runOnlyForDeploymentPostprocessing = 0;
527527 shellPath = /bin/sh;
528- shellScript = "../node_modules/react-native/packager/react-native-xcode.sh";
528+ shellScript = "export NODE_BINARY=node\n ../node_modules/react-native/packager/react-native-xcode.sh";
529529 showEnvVarsInLog = 1;
530530 };
531531/* End PBXShellScriptBuildPhase section */
Original file line number Diff line number Diff line change 1010# This script is supposed to be invoked as part of Xcode build process
1111# and relies on envoronment variables (including PWD) set by Xcode
1212
13+ PACKAGER_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
14+
1315case " $CONFIGURATION " in
1416 Debug)
1517 DEV=true
2628# Xcode project file for React Native apps is located in ios/ subfolder
2729cd ..
2830
29- set -x
30- DEST=$CONFIGURATION_BUILD_DIR /$UNLOCALIZED_RESOURCES_FOLDER_PATH
31-
3231# Define NVM_DIR and source the nvm.sh setup script
3332[ -z " $NVM_DIR " ] && export NVM_DIR=" $HOME /.nvm"
3433
@@ -43,10 +42,25 @@ if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then
4342 eval " $( $HOME /.nodenv/bin/nodenv init -) "
4443fi
4544
46- # npm global install path may be a non-standard location
47- PATH=" $( npm prefix -g) /bin:$PATH "
45+ [ -z " $NODE_BINARY " ] && export NODE_BINARY=" node"
46+
47+ nodejs_not_found ()
48+ {
49+ echo " error: Can't find '$NODE_BINARY ' binary to build React Native bundle" >&2
50+ echo " If you have non-standard nodejs installation, select your project in Xcode," >&2
51+ echo " find 'Build Phases' - 'Bundle React Native code and images'" >&2
52+ echo " and change NODE_BINARY to absolute path to your node installation" >&2
53+ echo " (you can find it by invoking 'which node' in your terminal)" >&2
54+ exit 2
55+ }
56+
57+ type $NODE_BINARY > /dev/null 2>&1 || nodejs_not_found
58+
59+ # Print commands before executing them (useful for troubleshooting)
60+ set -x
61+ DEST=$CONFIGURATION_BUILD_DIR /$UNLOCALIZED_RESOURCES_FOLDER_PATH
4862
49- react-native bundle \
63+ $NODE_BINARY $PACKAGER_DIR /../local-cli/cli.js bundle \
5064 --entry-file index.ios.js \
5165 --platform ios \
5266 --dev $DEV \
You can’t perform that action at this time.
0 commit comments