[英]React Native Project is not running on iOS Simulator using Apple M1 chip
[英]Building React native fail on iOS - using Apple M1 chip
我有一台新的 Mac,我按照安裝說明進行操作。
當我運行命令時:
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 失敗)
我正在使用 Xcode 12.5
xCode 12.5 是這里的問題。 它似乎破壞了 react-native 構建。 這里提到了解決方案 - https://github.com/facebook/react-native/issues/31179#issuecomment-830184757
看起來你在 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
)pod install
,清理並重建應用程序只是為了我使用 Mac M1 船的信息,
當我執行 Flipper 命令時,出現此錯誤:
[!] Invalid `Podfile` file: unknown keywords: "Flipper", "Flipper-Folly".
# from /Users/aghiadmonier/Public/Projects/Awsom/ios/Podfile:24
# -------------------------------------------
你應該禁用下一行。
use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3')
像這樣更新你的Podfile
use_flipper!({ 'Flipper' => '0.91.1', 'Flipper-Folly' => '~> 2.6', 'Flipper-RSocket' => '~> 1.4' })
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
end
end
flipper_post_install(installer)
react_native_post_install(installer)
end
並在運行pod install
之后
當您嘗試在 M1(Apple Silicon Chip)中使用以下命令創建項目時:
npx react-native init ProjectName
嘗試使用以下步驟構建:
softwareupdate — install-rosetta
”命令。npx react-native init ProjectName
npx react-native start to start
地鐵。npx react-native run-android
運行到 Androidnpx react-native run-ios
以運行到 iOS。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.