简体   繁体   English

构建操作失败,未为React Native Xcode项目指定任何错误

[英]Build operation failed without specifying any errors for React Native Xcode project

I have a React Native project that works fine most of the time(Android and iOS). 我有一个React Native项目,在大多数时间(Android和iOS)都能正常工作。 But sometimes out of nowhere I receive this error when I am trying to build the Xcode project (Xcode or react-native run-ios ): 但是有时在尝试构建Xcode项目(Xcode或react-native run-ios )时,我无处不在收到此错误:

Build operation failed without specifying any errors. 
Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie)
processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.

How do I solve this? 我该如何解决? Push to a branch on git, fresh clone, npm install, and all is working fine for a period. 推送到git上的分支,新鲜克隆,npm安装,并且在一段时间内一切正常。 And after that the problem will repeat. 之后,该问题将再次发生。 Making fresh clones of project each time is a pain and takes long time. 每次制作新的项目克隆都是一件痛苦的事情,并且需要很长时间。 Is there another way or something that I don't know? 还有其他我不知道的方法吗?

Maybe a some files that are in .gitignore is causing the problems, and after a fresh clone that solves the problem. 可能是.gitignore中的某些文件导致了此问题,并在重新克隆后解决了该问题。 This is the .gitignore file for my iOS project: 这是我的iOS项目的.gitignore文件:

# Created by .ignore support plugin (hsz.mobi)
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

我遇到了同样的问题,并通过删除node_modules的内容并在父文件夹中进行npm安装来解决此问题。

I was faced with this problem too. 我也面临这个问题。 And I noticed that my folder name was too long. 而且我注意到我的文件夹名称太长。 I changed the project folder's name with the short one and this error gone. 我用短的名称更改了项目文件夹的名称,此错误消失了。 Try to change the project folder name. 尝试更改项目文件夹的名称。

It was really a time killer issue. 这确实是一个时间杀手的问题。 I rebased the complete code base to a collegue's mac where it worked fine. 我将完整的代码库重新建立到同事的Mac上,在这里工作良好。 After sparing more than a couple of morning hours I could find a solution. 在节省了几个上午的时间后,我可以找到解决方案。

Solution - Simply shorten your Project folder name (in mac). 解决方案-只需缩短您的Project文件夹名称(在Mac中)。 This is undoubtedly irritating that its suggested to have longer and meaningful variable names but the folder name has to be this concise. 毫无疑问,这建议它使用更长且有意义的变量名,但是文件夹名称必须如此简洁。

I had a issue with XCode 9.1 and iOS 11... XCode 9.1和iOS 11出现问题... 在此处输入图片说明 I solved this issue moving up my folder to another path, I know it doesn't make sense and is dumb but it really work for me. 我解决了这个问题,将文件夹上移到另一个路径,我知道这没有意义,而且很笨,但是对我来说确实有用。 My project was at /Users/Me/Documents/MyProjectDir and I changed to /Users/Me/Desktop/MyProjectDir 我的项目位于/Users/Me/Documents/MyProjectDir ,我更改为/Users/Me/Desktop/MyProjectDir

帮助我的是删除React Native项目中的ios/build文件夹,然后重建该项目。

I highly recommend to run the build on console , to see if it outputs any other relevant information. 我强烈建议在控制台运行该构建 ,以查看其是否输出任何其他相关信息。

react-native run-ios --scheme "app-debug" # Or any aproppriate target

Read more about building+archiving from CLI here or try with other OSS tooling like fastlane . 在此处阅读有关从CLI构建和归档的更多信息或尝试使用其他OSS工具(如fastlane)

For me it found bugs twice, that both were unrelated with the building process itself: 对我来说,它发现了两次错误,它们都与构建过程本身无关:

1) One was fixed rolling back to node v8 (LTS) apparently. 1)一个固定地显然回滚到节点v8(LTS)。 It was very obscure, but I suspect had to do with having little memory available (running flow + packager + xcode + spotify + chrome on 8GB RAM MBP) 这是非常晦涩的,但是我怀疑这与可用内存很少有关(运行流+打包程序+ xcode + spotify + 8GB RAM MBP上的chrome)

2) The other one was related to having a space on the xcode output. 2)另一个与在xcode输出上留有空格有关。 "App Canary.app" could not be installed. 无法安装“ App Canary.app”。 I figured it out doing ls ios/build/Build/products... . 我知道是在做ls ios/build/Build/products... This error only happened after upgrading xcode, and wasn't happening with the release target, that did not have any whitespaces. 此错误仅在升级xcode之后发生,而在没有任何空格的发行版目标中则没有发生。

The only take away here is to run build directly on the console to debug further . 这里唯一的收获是直接在控制台上运行build来进一步调试 You might find out things that are completely unrelated, and probably can't be solved by just removing the build folder. 您可能会发现完全不相关的内容,可能仅通过删除构建文件夹无法解决。

Hope it helps. 希望能帮助到你。

垃圾iOS / Build为我解决了这个问题

In my case simulator is not shutdown correctly. 就我而言,模拟器无法正确关闭。

So I opened simulator manually again then I got an error that simulator is not shutdown correctly.So I relaunched the simulator successfully and built xcode project again. 所以我再次手动打开了模拟器,但是却收到一个错误消息,指出模拟器无法正确关闭,因此我成功地重新启动了模拟器并再次构建了xcode项目。 Error is resolved 错误已解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM