在 iOS 上构建 React Native 失败 - 使用 Apple M1 芯片 [英] Building React native fail on iOS - using Apple M1 chip

查看:173
本文介绍了在 iOS 上构建 React Native 失败 - 使用 Apple M1 芯片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台新 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

  1. 更新 podfile 以使用

use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3')

  1. 更新 package.json 以使用

"react-native": "facebook/react-native#cf8a364767df830d7255339741350bb53ab1a68a"

  1. 运行npm install(或yarn)
  2. 在ios文件夹中运行pod install,清理并重建应用
  1. run npm install (or yarn)
  2. run pod install in the ios folder, clean and rebuild app

这篇关于在 iOS 上构建 React Native 失败 - 使用 Apple M1 芯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆