Search code examples
iosreact-nativeignite

React native Ignite ios build fails with Command PhaseScriptExecution failed with a nonzero exit code


for two days I have been trying to run an existing project built with Ignite boilerplate, android version works fine but I can't get a build of ios. first, there is an error related to unary_function and after fixing it I face a new error "Command PhaseScriptExecution failed with a nonzero exit code" in XCode.

    ...
address/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'react-native-safe-area-context' from project 'Pods')
    warning: Run script build phase '[CP-User] Generate app.config for prebuilt Constants.manifest' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXConstants' from project 'Pods')
    
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS Simulator, id:9251DE04-CE06-4D88-95C7-5AABCCF008BE, OS:17.2, name:iPhone 15 Plus }
    { platform:iOS Simulator, id:9251DE04-CE06-4D88-95C7-5AABCCF008BE, OS:17.2, name:iPhone 15 Plus }
    ** BUILD FAILED **
    
    
    The following build commands failed:
            PhaseScriptExecution [CP-User]\ Generate\ app.config\ for\ prebuilt\ Constants.manifest /Users/name/Library/Developer/Xcode/DerivedData/guardian-anwhhkyjhbavobalirikdkvqliqv/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/EXConstants.build/Script-46EB2E00024160.sh (in target 'EXConstants' from project 'Pods')
    (1 failure)
    
    info Run CLI with --verbose flag for more details.
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I have tried many things suggested on ignite issues and other questions on Stack and ... but none of them works.

XCode: 15.1
react: 18.2.0
react-native: 0.71.7
Node: v18.12.1
yarn: 1.22.19
npm: 9.8.1

didn't work : https://github.com/expo/expo/issues/15809 PhaseScriptExecution failed for react-native-config on Xcode build ...


Solution

  • I updated everything such as nvm rvm node ruby and ... and it did not help. Then I removed the comments in bash_profile and it did not help, however, the next time I removed everything in bash_profile, now there is an empty bash_profile and now it works on iOS. but the catch is that now I have a problem with running Android. need help

    I have a MacBook m1 pro

    and the error is

    warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
    info Starting the app...
    error Failed to start the app.
    Error: spawnSync adb ENOENT
        at Object.spawnSync (node:internal/child_process:1124:20)
        at Object.spawnSync (node:child_process:876:24)
        at module.exports.sync (/node_modules/execa/index.js:334:30)
        at tryLaunchAppOnDevice (/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:46:22)
        at node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:95:39
        at Array.forEach (<anonymous>)
        at runOnAllDevices (/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:90:48)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async Command.handleAction (/node_modules/@react-native-community/cli/build/index.js:108:9)
    

    ok, after a bit of time this worked for me:

    I tried adding the lines into bash_profile but was not successful, finally, I added some selected lines below and now I can run both :

    export ANDROID_HOME=/your path/Library/Android/sdk
    export PATH=${PATH}:/your path/Library/Android/sdk/tools
    export PATH=${PATH}:/your path/Library/Android/sdk/platform-tools
    export PATH=$PATH:$ANDROID_HOME/emulator
    export PATH=$PATH:$ANDROID_HOME/tools
    export PATH=$PATH:$ANDROID_HOME/tools/bin
    export PATH=$PATH:$ANDROID_HOME/platform-tools