Xcode 11 Command PhaseScriptExecution failed with a nonzero exit code

Running Mojave 10.14.6

Xcode 11.0 (11A420a)

iOS 13.1.2

iPhone 6s Plus


I cannot seem to find the solution here or on Stack Overflow.


When compiling, I keep getting this error:


Command PhaseScriptExecution failed with a nonzero exit code


I tried in Xcode


Xcode > Preferences > Accounts

signing in and out


I have created a new Dev Cert, Distribution Cert, new PUSH certs, new provisional profiles


I have tried pod updates


I have tried changing the Build Phase info with chmod +x

as recommended by this post

https://forums.developer.apple.com/thread/122796?start=0&tstart=0


I have tried rebooting my phone. I have tried rebooting the computer. rebooting xcode (obviously)


Don't know what else to do.

Post not yet marked as solved Up vote post of sharpwitz Down vote post of sharpwitz
215k views
  • Try this simple trick.. : https://not.justsolutionsproducts.com/xcode-11-command-phasescriptexecution-failed-with-a-nonzero-exit-code/

  • Too many ads on this links.... :(

  • Bogus link from Alquopi6, DO NOT CLICK ON IT

Replies

Nothing works for me. Even I've searched and tried any solutions over the three days...

Add a Comment

I'm in the process of re-adding dependencies for a project to bring them up to date, and I see this error message when a dependency is missing. The specific reason for the error -- in my case, which dependency is missing -- is shown in my build logs, which I view in Xcode by double clicking the error in the sidebar. Here's a sample log:

Error: Unable to resolve module @react-navigation/stack from /Users/s/Work/dev/js/myrn/interflexion/navigation/MainStack.js: @react-navigation/stack could not be found within the project or in these directories:  node_modules

If you are sure the module exists, try these steps:  1. Clear watchman watches: watchman watch-del-all  2. Delete node_modules and run yarn install  3. Reset Metro's cache: yarn start --reset-cache  4. Remove the cache: rm -rf /tmp/metro-* [0m [90m 1 |[39m [36mimport[39m [33mReact[39m [36mfrom[39m [32m'react'[39m[33m;[39m[0m [0m [90m 2 |[39m [36mimport[39m { [33mView[39m[33m,[39m [33mImageBackground[39m[33m,[39m [33mButton[39m } [36mfrom[39m [32m'react-native'[39m[0m [0m[31m[1m>[22m[39m[90m 3 |[39m [36mimport[39m { createStackNavigator } [36mfrom[39m [32m'@react-navigation/stack'[39m[33m;[39m[0m [0m [90m  |[39m                    [31m[1m^[22m[39m[0m [0m [90m 4 |[39m[0m [0m [90m 5 |[39m[0m [0m [90m 6 |[39m[0m   at ModuleResolver.resolveDependency (/Users/s/Work/dev/js/myrn/interflexion/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:129:15)   at DependencyGraph.resolveDependency (/Users/s/Work/dev/js/myrn/interflexion/node_modules/metro/src/node-haste/DependencyGraph.js:288:43)   at Object.resolve (/Users/s/Work/dev/js/myrn/interflexion/node_modules/metro/src/lib/transformHelpers.js:129:24)   at resolve (/Users/s/Work/dev/js/myrn/interflexion/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)   at /Users/s/Work/dev/js/myrn/interflexion/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26   at Array.reduce ()   at resolveDependencies (/Users/s/Work/dev/js/myrn/interflexion/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)   at processModule (/Users/s/Work/dev/js/myrn/interflexion/node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31)   at processTicksAndRejections (node:internal/process/task_queues:96:5)   at async addDependency (/Users/s/Work/dev/js/myrn/interflexion/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18) info Run CLI with --verbose flag for more details. Command PhaseScriptExecution failed with a nonzero exit code

Running this command fixed it for me:

sudo ln -s $(which node) /usr/local/bin/node

  • This worked, thanks for sharing!

  • thank u, worked for me!

  • This worked for me, thanks! I think my "n" library did not play nice with a react-native script and this fixed it.

This is still an ongoing problem. macOS 12.3 & Xcode 13.3 are fully up-to-date. Cleaned build folder and freshly integrated pods. Building will throw the same error.

We have tried all of the solutions short of locking the keychain (because apparently we cant do that anymore? the option is disabled) but alas, nothing has worked. Neither Login or local can be locked.

The only "solution" we have found to this problem is to restart the computer. Why? Great question! I don't know. I suspect its locking/unlocking the keychain which rectified whatever cert build error is occurring but its ridiculous to have to go to such lengths. Logging off of the user also does not help. It has to be a full reboot.

"nvm unalias default" fixed it.

After days of having a similar problem as yours, I did the following:

  • Follow this StackOverflow answer
  • Completely close all terminals & close XCode
  • Reopen XCode to successfully start compiling & archiving iOS builds 🚀

I can't also find a solution for this problem, the problem occurred in my application after I enable email/password dependency in firebase. I tried to run my application but this error occurred.

I have tired everything here, and my problem still sturbornly persists please, please help me

I have tried all the solutions here for iOS build with XCode 14.1 to solve the "PhaseScriptExecution failed..." issue in macOS Ventura but unfortunately did not solve it. Please anyone help me? Thanks in advance!

  • try commenting out the this file↓

    node_modules/react-native/scripts/find-node.sh

Add a Comment

Solved on my project/Machine by going on Xcode to: 'MyAppName' -> 'MyTargetName' -> BuildSettings -> ExcludedArchitectures -> (Remove all, in my case removing "arm64")

  • the solution for our project was to go to the Xcode->Preferences...->Accounts and remove a develop certificate and create a new one via "Manage certificate..." button

    p.s. and, perhaps, the good point is to remove all expired certificates too

Add a Comment

the solution for our project was to go to the Xcode->Preferences...->Accounts and remove a develop certificate and create a new one via "Manage certificate..." buttonp.s. and, perhaps, the good point is to remove all expired certificates too

Hey guys, I found the solution ( I can not confirm this is a long term solution) but allows you to archive the application without issues:

Search for the following line in your XCode project:

source="$(readlink "${source}")"

Now, replace all of its ocurrences with the following code:

source="$(readlink -f "${source}")"

That should do the trick while we get to know more about this issue.

Add a Comment

Resolved - This worked for me Targets>App>General>Supported Destinations- Remove Mac

I know this looks strange, but check your Mac storage space. If you are missing space, Xcode reports a lot of different errors, but most of the time it doesn't report that disk space is low.