在 iOS 上构建 React Native 失败 - 使用 Apple M1 芯片 [英] Building React native fail on iOS - using Apple M1 chip
问题描述
我有一台新的 mac,我按照安装说明进行了操作.
I've got a new mac and I followed the instructions for the installation.
当我运行命令时:
npx react-native init ProjectName
出现以下错误
** BUILD FAILED **
以下构建命令失败:CompileC/Users/aghiadmonier/Library/Developer/Xcode/DerivedData/test-bbpkvpircnzzukgpgaaohkixdojw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/ConnectionContextStore.o/Users/aghiadmonier/Desktop/React/test/ios/Pods/Flipper/xplat/Flipper/ConnectionContextStore.cpp 正常 x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler(1 次失败)
The following build commands failed: CompileC /Users/aghiadmonier/Library/Developer/Xcode/DerivedData/test- bbpkvpircnzzukgpgaaohkixdojw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/ConnectionContextStore.o /Users/aghiadmonier/Desktop/React/test/ios/Pods/Flipper/xplat/Flipper/ConnectionContextStore.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (1 failure)
我使用的是 Xcode 12.5
I am using Xcode 12.5
推荐答案
xCode 12.5 是这里的问题.它似乎破坏了 react-native 构建.这里提到了解决方案 - https://github.com/facebook/react-native/issues/31179#issuecomment-830184757
xCode 12.5 is the problem here. It seems to break react-native builds. Solutions are mentioned here - https://github.com/facebook/react-native/issues/31179#issuecomment-830184757
看起来您使用的是 react-native 0.64
looks like you're on react-native 0.64
- 更新
podfile
以使用
use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3')
- 更新
package.json
以使用
"react-native": "facebook/react-native#cf8a364767df830d7255339741350bb53ab1a68a"
- 运行
npm install
(或yarn
) - 在ios文件夹中运行
pod install
,清理并重建app
- run
npm install
(oryarn
) - run
pod install
in the ios folder, clean and rebuild app
这篇关于在 iOS 上构建 React Native 失败 - 使用 Apple M1 芯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!