first
npx react-native@newest init NewArchProject
then
brew set up ios-deploy
then
bundle set up && RCT_NEW_ARCH_ENABLED=1 bundle exec pod set up
then
yarn iOS (or xcode and construct the workspace)
this at all times ends in:
Command PhaseScriptExecution failed with a nonzero exit code
** BUILD FAILED **
The next construct instructions failed:
PhaseScriptExecution Bundle React Native code and pictures /Customers/michaelisbell/Library/Developer/Xcode/DerivedData/NewArchProject-ayyhimbtgfibktdhdedbyagzfbuj/Construct/Intermediates.noindex/NewArchProject.construct/Debug-iphoneos/NewArchProject.construct/Script-00DD1BFF1BD5951E006B06BC.sh (in goal 'NewArchProject' from mission 'NewArchProject')
(1 failure)
error Command failed with exit code 1.
information Go to https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have to know the right way to resolve this relatively opaque error and get the app to run.
MORE DETAIL:
in xcode, that is present within the log:
+ [[ Debug = *Debug* ]]
+ [[ ! iphoneos == *simulator ]]
+ for num in 0 1 2 3 4 5 6 7 8
++ ipconfig getifaddr en0
+ IP=
Command PhaseScriptExecution failed with a nonzero exit code```
======
within the construct section "bundle react-native code and pictures":
```set -e
WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
=====
the primary script, with-environment.sh
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and associates.
#
# This supply code is licensed below the MIT license discovered within the
# LICENSE file within the root listing of this supply tree.
# This script is used to supply in Xcode the surroundings settings required to run correctly.
# The script first sources the bottom `.xcode.env` file.
# Then it sources the `.xcode.env.native` file if current, to override some native config
# Lastly, it would execute the command handed i enter if any.
#
# USAGE:
# ./with-environment.sh command
# Begin with a default
NODE_BINARY=$(command -v node)
export NODE_BINARY
# Override the default with the worldwide surroundings
ENV_PATH="$PODS_ROOT/../.xcode.env"
if [ -f "$ENV_PATH" ]; then
supply "$ENV_PATH"
fi
# Override the worldwide with the native surroundings
LOCAL_ENV_PATH="${ENV_PATH}.native"
if [ -f "$LOCAL_ENV_PATH" ]; then
supply "$LOCAL_ENV_PATH"
fi
# Verify whether or not NODE_BINARY has been correctly set, in any other case assist the customers with a significant error.
if [ -n "$NODE_BINARY" ]; then
echo "Node discovered at: ${NODE_BINARY}"
else
echo '[Warning] That you must configure your node path within the `".xcode.env" file` surroundings. '
'You'll be able to set it up rapidly by working: '
'`echo export NODE_BINARY=$(command -v node) > .xcode.env` '
'within the ios folder. That is wanted by React Native to work appropriately. '
'We fallback to the DEPRECATED conduct of discovering `node`. This can be REMOVED in a future model. '
'You'll be able to learn extra about this right here: https://reactnative.dev/docs/environment-setup#optional-configuring-your-environment' >&2
supply "${REACT_NATIVE_PATH}/scripts/find-node-for-xcode.sh"
fi
# Execute argument, if current
if [ -n "$1" ]; then
$1
fi
the second script, react-native-xcode.sh
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and associates.
#
# This supply code is licensed below the MIT license discovered within the
# LICENSE file within the root listing of this supply tree.
# Bundle React Native app's code and picture property.
# This script is meant to be invoked as a part of Xcode construct course of
# and depends on surroundings variables (together with PWD) set by Xcode
# Print instructions earlier than executing them (helpful for troubleshooting)
set -x -e
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
# Permits iOS gadgets to get the IP handle of the machine working Metro
if [[ ! "$SKIP_BUNDLING_METRO_IP" && "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then
for num in 0 1 2 3 4 5 6 7 8; do
IP=$(ipconfig getifaddr en${num})
if [ ! -z "$IP" ]; then
break
fi
executed
if [ -z "$IP" ]; then
IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | grep -v ' 169.254.' |minimize -d -f2 | awk 'NR==1{print $1}')
fi
echo "$IP" > "$DEST/ip.txt"
fi
if [[ "$SKIP_BUNDLING" ]]; then
echo "SKIP_BUNDLING enabled; skipping."
exit 0;
fi
case "$CONFIGURATION" in
*Debug*)
if [[ "$PLATFORM_NAME" == *simulator ]]; then
if [[ "$FORCE_BUNDLING" ]]; then
echo "FORCE_BUNDLING enabled; persevering with to bundle."
else
echo "Skipping bundling in Debug for the Simulator (because the packager bundles for you). Use the FORCE_BUNDLING flag to vary this conduct."
exit 0;
fi
else
echo "Bundling for bodily gadget. Use the SKIP_BUNDLING flag to vary this conduct."
fi
DEV=true
;;
"")
echo "$0 have to be invoked by Xcode"
exit 1
;;
*)
DEV=false
;;
esac
# Path to react-native folder inside node_modules
REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# Most tasks have their mission root, one degree up from their Xcode mission dir (the "ios" listing)
PROJECT_ROOT=${PROJECT_ROOT:-"$PROJECT_DIR/.."}
cd "$PROJECT_ROOT" || exit
# Outline entry file
if [[ "$ENTRY_FILE" ]]; then
# Use ENTRY_FILE outlined by person
:
elif [[ -s "index.ios.js" ]]; then
ENTRY_FILE=${1:-index.ios.js}
else
ENTRY_FILE=${1:-index.js}
fi
# verify and assign NODE_BINARY env
# shellcheck supply=/dev/null
supply "$REACT_NATIVE_DIR/scripts/node-binary.sh"
HERMES_ENGINE_PATH="$PODS_ROOT/hermes-engine"
[ -z "$HERMES_CLI_PATH" ] && HERMES_CLI_PATH="$HERMES_ENGINE_PATH/destroot/bin/hermesc"
# If hermesc will not be out there and USE_HERMES will not be set to false, present error.
if [[ $USE_HERMES != false && -f "$HERMES_ENGINE_PATH" && ! -f "$HERMES_CLI_PATH" ]]; then
echo "error: Hermes is enabled however the hermesc binary couldn't be discovered at ${HERMES_CLI_PATH}."
"Maybe it's essential to run 'bundle exec pod set up' or in any other case "
"level the HERMES_CLI_PATH variable to your customized location." >&2
exit 2
fi
[ -z "$NODE_ARGS" ] && export NODE_ARGS=""
[ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/cli.js"
[ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle"
[ -z "$COMPOSE_SOURCEMAP_PATH" ] && COMPOSE_SOURCEMAP_PATH="$REACT_NATIVE_DIR/scripts/compose-source-maps.js"
if [[ -z "$BUNDLE_CONFIG" ]]; then
CONFIG_ARG=""
else
CONFIG_ARG="--config $BUNDLE_CONFIG"
fi
BUNDLE_FILE="$CONFIGURATION_BUILD_DIR/predominant.jsbundle"
EXTRA_ARGS=
case "$PLATFORM_NAME" in
"macosx")
BUNDLE_PLATFORM="macos"
;;
*)
BUNDLE_PLATFORM="ios"
;;
esac
if [ "${IS_MACCATALYST}" = "YES" ]; then
BUNDLE_PLATFORM="ios"
fi
EMIT_SOURCEMAP=
if [[ ! -z "$SOURCEMAP_FILE" ]]; then
EMIT_SOURCEMAP=true
fi
PACKAGER_SOURCEMAP_FILE=
if [[ $EMIT_SOURCEMAP == true ]]; then
if [[ $USE_HERMES != false ]]; then
PACKAGER_SOURCEMAP_FILE="$CONFIGURATION_BUILD_DIR/$(basename $SOURCEMAP_FILE)"
else
PACKAGER_SOURCEMAP_FILE="$SOURCEMAP_FILE"
fi
EXTRA_ARGS="$EXTRA_ARGS --sourcemap-output $PACKAGER_SOURCEMAP_FILE"
fi
# Hermes would not require JS minification.
if [[ $USE_HERMES != false && $DEV == false ]]; then
EXTRA_ARGS="$EXTRA_ARGS --minify false"
fi
"$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND
$CONFIG_ARG
--entry-file "$ENTRY_FILE"
--platform "$BUNDLE_PLATFORM"
--dev $DEV
--reset-cache
--bundle-output "$BUNDLE_FILE"
--assets-dest "$DEST"
$EXTRA_ARGS
$EXTRA_PACKAGER_ARGS
if [[ $USE_HERMES == false ]]; then
cp "$BUNDLE_FILE" "$DEST/"
BUNDLE_FILE="$DEST/predominant.jsbundle"
else
EXTRA_COMPILER_ARGS=
if [[ $DEV == true ]]; then
EXTRA_COMPILER_ARGS=-Og
else
EXTRA_COMPILER_ARGS=-O
fi
if [[ $EMIT_SOURCEMAP == true ]]; then
EXTRA_COMPILER_ARGS="$EXTRA_COMPILER_ARGS -output-source-map"
fi
"$HERMES_CLI_PATH" -emit-binary -max-diagnostic-width=80 $EXTRA_COMPILER_ARGS -out "$DEST/predominant.jsbundle" "$BUNDLE_FILE"
if [[ $EMIT_SOURCEMAP == true ]]; then
HBC_SOURCEMAP_FILE="$DEST/predominant.jsbundle.map"
"$NODE_BINARY" "$COMPOSE_SOURCEMAP_PATH" "$PACKAGER_SOURCEMAP_FILE" "$HBC_SOURCEMAP_FILE" -o "$SOURCEMAP_FILE"
rm "$HBC_SOURCEMAP_FILE"
rm "$PACKAGER_SOURCEMAP_FILE"
fi
BUNDLE_FILE="$DEST/predominant.jsbundle"
fi
if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then
echo "error: File $BUNDLE_FILE doesn't exist. Your surroundings is misconfigured as Metro was not capable of produce the bundle so your launch utility will not work!" >&2
exit 2
fi
Be aware, as a comply with up right here, to strive once more I
- ensured just one node on the system, 20.10.0
- made certain xcode.env.native factors at that node
- deleted yarn.lock and package-lock .json
- deleted and reinstalled node modules
- deleted and reinstalled pods
- cleaned construct
similar downside