首页 > 解决方案 > CircleCI + React Native + Xcode 10

问题描述

我有一个应用程序在 Xcode 9 上的 CircleCI 上使用 React Native 0.57.7 运行良好。但是我们需要将 Xcode 版本提升到 10.1.0。

但是当我切换它时,Ci 停止工作,即使启用旧系统(-UseNewBuildSystem=NO-UseModernBuildSystem=0传递给 Fastlane 的build_ios_app),我也会收到“Myapp.app/main.jsbundle 不存在”错误。

▸ + echo 'error: File /Users/distiller/project/ios/build/Build/Intermediates.noindex/ArchiveIntermediates/Myapp/BuildProductsPath/Release-iphoneos/Myapp.app/main.jsbundle does not exist. This must be a bug with'
▸ error: File /Users/distiller/project/ios/build/Build/Intermediates.noindex/ArchiveIntermediates/Myapp/BuildProductsPath/Release-iphoneos/Myapp.app/main.jsbundle does not exist. This must be a bug with
▸ + echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
▸ React Native, please report it here: https://github.com/facebook/react-native/issues

标签: iosxcodereact-nativecirclecifastlane

解决方案


在花了几个小时来弄清楚它发生了什么之后,我发现了这个问题:构建失败了,因为 CircleCI 上 Xcode 10.1.0 的 docker 镜像缺少 React Native 构建应用程序所需的一些依赖项。

错误只是说“main.jsbundle 不存在”。当 xcodereact-native-cli bundlereact-native-xcode.sh文件运行时会发生这种情况。它并没有说明错误的根本原因:watchman此 Xcode 版本使用的 docker 映像中缺少。

为什么这些图像没有相同的安装包?我不知道。我只希望图像之间安装相同的软件包。

添加brew install watchman使 CI 再次通过:

- run:
    name: "Install React Native dependencies"
    command: |
      brew update
      brew install watchman

我希望react-native-xcode.sh可以返回根错误,而不仅仅是main.jsbundle does not exist


推荐阅读