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条回答
劫难
2楼-- · 2020-01-24 23:28

If you are facing an error like that on new MacOS version.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

It means that you need to install XCode command line, open a Terminal and run this command:

$ xcode-select --install

查看更多
【Aperson】
3楼-- · 2020-01-24 23:28

In my case it was renaming a file to an existing file in other folder(Group) by mistake, just rename it to what it was then the error disappeared

查看更多
再贱就再见
4楼-- · 2020-01-24 23:29

This error happened to me when I forgot to change entity Properties before creating NSManagedObject subclass. Solved by:

  1. delete Entity+CoreDataClass.swift and Entity+CoreDataProperties.swift.
  2. under "class" of the entity model inspector, change "module" to Current Product Module and "codegen" to Manual/None.
  3. recreate the NSManagedObject.

image

查看更多
放我归山
5楼-- · 2020-01-24 23:29

I had the JSONwebtoken pod installed and that was causing issues. I needed to delete the CommonCrypto folder that is in the JSONWebtoken pod folder. Here is a ->link<- explaining the issue. This started happening in Xcode 10.

查看更多
Juvenile、少年°
6楼-- · 2020-01-24 23:30

I tried a lot of the options discussed here.

  • Delete and reinstall pods
  • Clean Build Folder
  • Delete Derived Data
  • Add SWIFT_ENABLE_BATCH_MODE and set its value to NO
  • Restarting Xcode and Recompiling
  • Restarting iMac and Recompiling
  • set Compilation Mode to Incremental
  • Changed build settings: SWIFT_COMPILATION_MODE = singlefile and SWIFT_OPTIMIZATION_LEVEL = "-O"

Nothing worked. I'm using Xcode Version 11.0 beta (11M336w).

Finally I downloaded a fresh copy and replaced the one I had previously installed. It was the same exact version. That did the trick.

查看更多
Luminary・发光体
7楼-- · 2020-01-24 23:30

I have faced similar problem. I have done

  • clean project - didn't work
  • Remove Derived Data Folder - didn't work
  • Change build system to Legacy Build Settings - didn't work
  • Restart XCode - didn't work
  • Comment some of my code, a typedef NS_ENUM in .h file and enums related works. Build the system and build success shown. Next un-comment the code and build again - Magically works
查看更多
登录 后发表回答