I recently upgraded my app’s react native
version from 0.72.3
to 0.76.5
, made changes carefully by getting help from react native upgrade helper. Everything was running smoothly, were able to build the application using Xcode 16.2 (macOS Sonoma 14.5) or command line. Somehow, it stopped building throwing an error at build time saying:
Command PhaseScriptExecution failed with a nonzero exit code
package.json
{
"name": "MYAPP",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"@bam.tech/react-native-image-resizer": "^3.0.10",
"@m-c2/ripple": "^1.0.7",
"@notifee/react-native": "^7.8.0",
"@react-native-async-storage/async-storage": "^1.19.3",
"@react-native-camera-roll/camera-roll": "^6.0.0",
"@react-native-community/geolocation": "^3.1.0",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^10.0.0",
"@react-native-firebase/app": "^21.6.1",
"@react-native-firebase/messaging": "^21.6.1",
"@react-native-picker/picker": "^2.5.0",
"@react-navigation/bottom-tabs": "^6.5.8",
"@react-navigation/native": "^6.1.17",
"@reduxjs/toolkit": "^2.5.0",
"@tanstack/query-async-storage-persister": "^5.4.3",
"@tanstack/react-query": "^4.12.0",
"@tanstack/react-query-persist-client": "^5.4.3",
"@types/react-native-check-box": "^2.1.6",
"axios": "^1.7.7",
"dayjs": "^1.11.9",
"deprecated-react-native-prop-types": "^5.0.0",
"formik": "^2.4.4",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"lottie-react-native": "^6.2.0",
"react": "18.3.1",
"react-intl": "^6.4.7",
"react-native": "0.76.5",
"react-native-autocomplete-input": "^5.4.0",
"react-native-calendars": "^1.1302.0",
"react-native-check-box": "^2.1.7",
"react-native-config": "^1.5.3",
"react-native-country-picker-modal": "^2.0.0",
"react-native-date-picker": "^4.3.3",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.13.1",
"react-native-image-picker": "^7.1.2",
"react-native-linear-gradient": "^2.8.3",
"react-native-maps": "^1.7.1",
"react-native-page-indicator": "^2.2.0",
"react-native-permissions": "^3.10.1",
"react-native-popover-view": "^6.0.1",
"react-native-push-notification": "^8.1.1",
"react-native-qrcode-svg": "^6.3.12",
"react-native-reanimated": "^3.5.4",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-restart": "^0.0.27",
"react-native-safe-area-context": "^4.7.2",
"react-native-screens": "^3.25.0",
"react-native-simple-toast": "^3.0.2",
"react-native-splash-screen": "^3.3.0",
"react-native-svg": "^15.10.1",
"react-native-switch-with-icons": "^3.0.1",
"react-native-view-shot": "^3.8.0",
"react-native-vision-camera": "^2.15.6",
"react-native-webview": "^11.23.1",
"react-redux": "^9.2.0",
"react-router-native": "^6.15.0",
"yup": "^1.2.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.5",
"@react-native/eslint-config": "0.76.5",
"@react-native/metro-config": "0.76.5",
"@react-native/typescript-config": "0.76.5",
"@tsconfig/react-native": "^3.0.0",
"@types/lodash": "^4.14.197",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"@types/yup": "^0.32.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-native-svg-transformer": "^1.1.0",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
},
"packageManager": "[email protected]"
}
Podfile
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, min_ios_version_supported
prepare_react_native_project!
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
target 'MYAPP' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
# Firebase pods
pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
# PhotoLibrary pod
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
target 'MYAPPTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
end
end
I already tried reinstalling node dependencies and pods, by removing node_modules folder and by cleaning Xcode build, pods folder and lock file. Nothing worked 😔
Used these commands:
rm -rf node_modules
npm install
rm -rf Pods Podfile.lock
rm -rf ~/Library/Developer/Xcode/DerivedData
cd ios
&&pod install
Any help in fixing this issue will be much appreciated, thanks in advance 🙏
M Hassan Jamil is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.