Build fails with “Command failed with a nonzero ex

2020-01-24 22:45发布

When I try to build my app with Xcode, an error interrupts the build process:

Command CompileStoryboard failed with a nonzero exit code

Sometimes, it shows this error instead:

Command CompileSwift failed with a nonzero exit code

I have New Build System turned on.

What can I do to fix this?

标签: xcode
30条回答
Juvenile、少年°
2楼-- · 2020-01-24 23:17

What helped to me is to set Compilation Mode to Incremental for all configurations in Target's Build Settings. With Whole module compilation mode I got errors. But this setting made project build slower.

查看更多
家丑人穷心不美
3楼-- · 2020-01-24 23:19

Switching to the legacy build system fixed the issue for me

查看更多
SAY GOODBYE
4楼-- · 2020-01-24 23:20

If you have multiple targets, where two or more targets have files with the same name, check the target membership of those files in Files inspector. The error occurs when multiple instances of the equally named file have set the target membership for the same target.

查看更多
做自己的国王
5楼-- · 2020-01-24 23:20

I had the error Command LinkStoryboards failed with a nonzero exit code, and found that I was using an external storyboard reference to a non-existent storyboard. I had recently changed the name of a storyboard file, so changing the reference from the 'old' name to the 'new' name solved it for me.
You may not have exactly the same error as me, but an easy way to find a more detailed explanation of the error is to:

  • Show the issue navigator (while the build time error is showing)
  • Click the error: Click the error in the issue navigator
  • Then, you should see more about your error: Command LinkStoryboards failed with nonzero exit code


I hope this helps. Please, I am aware that I am answering from experience of a different error than this question was asked about, but I believe this advice should help you conquer similar problems!

查看更多
不美不萌又怎样
6楼-- · 2020-01-24 23:20

I had the same error Restarting Xcode and Recompiling Fixed the issue for me.

查看更多
淡お忘
7楼-- · 2020-01-24 23:21

In my case, I used too complicated initializations inside a class extension. It suddenly broke my build.

class MyClass { }
extension MyClass {
static var  var1 = "", var2 = "", var3 = "", var4 = "", ...., var20 = ""
}

Resolved:

class MyClass { }
    extension MyClass {
    static var var1 = "",
    static var var2 = "",
    static var var3 = ""
    static var var4 = "", ...., 
    static var var20 = ""
    }
查看更多
登录 后发表回答