I am working on a React Native project, and while building the project in Xcode works fine, for releasing the app to app store, and archiving it fails with the following error:
Command PhaseScriptExecution failed with a nonzero exit code
This error occurs in the "Run custom shell script 'Bundle React Native code and images'" phase.
/opt/homebrew/bin/node
(Output from which node
)Here’s the script currently in the "Bundle React Native code and images" phase:
set -e
WITH_ENVIRONMENT="$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"
/bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE"
Checked for the existence of with-environment.sh
and react-native-xcode.sh
in node_modules/react-native/scripts
– The scripts
folder is missing.
Reinstalled node_modules
using npm install
and yarn install
– no change.
Verified that $REACT_NATIVE_PATH
is empty when echoed.
Updated the script to directly use:
export NODE_BINARY=/opt/homebrew/bin/node
../node_modules/react-native/scripts/react-native-xcode.sh
– This didn’t solve the issue.
Cleaned the build folder in Xcode and removed DerivedData
.
Ran pod install --repo-update
in the ios
directory.
scripts
folder is missing in node_modules/react-native
?Any help or pointers would be greatly appreciated!
I have tried multiple solutions that GPT suggested but nothing got fixed unfortunately :(
Alot of other stackoverflow answers suggested this fix but this was already fixed in my code by default:
update all the generated ...-frameworks.sh files to add the -f flag to the call to readlink. In other words, need to replace:
source="$(readlink "${source}")"
with
source="$(readlink -f "${source}")"
I came across the same error too, here's how to actually debug the issue
in my case it was this Error: Unable to resolve module ../../../../assets/icons/BullseyeIcon
Fix any missing assets or incorrect paths in your code attempt to Archive the project again Goodluck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With