'PhaseScriptExecution failed and CompileSwiftSources failed

Objective

I am trying to build my project to an iOS simulator or physical device using Xcode.

System and software details

macOS Monterey Version 12.2.1

Macbook Pro (2021)

Chip: Apple M1 Pro

Memory: 16GB

XCode 13.0

Node version: 16.14.2

npm version: 8.5.0

Problem

On opening my project in Xcode, this message is displayed: Xcode message

Running build fails with:

Command PhaseScriptExecution failed with a nonzero exit code

and

remark: Incremental compilation has been disabled: it is not compatible with whole module optimization Command CompileSwiftSources failed with a nonzero exit code

Error message

PhaseScriptExecution error message

CompileSwiftSources error message

What we've tried

I've tried a lot of solutions online but no luck Solutions tried are:

  • Build Settings -> Compilation Mode -> Switch to "Incremental" (This didnt help because the setting was already on "Incremental")
  • Excluding arm64 architecture in build settings
  • Changing swift version in build settings

I've tried Xcode 13.0, 13.2, 13.2.1, 13.3, 12.5

Does anyone have a solution to this?

Please tell me if any other information is needed



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source