在 Mac mini(Apple M1,2020)运行 Monterey 上初始化 react-native 应用程序时出现 Cocoapods 错误

Cocoapods error when Initializing react-native app on Mac mini (Apple M1, 2020) running Monterey

我正在使用 Mac mini 和 Monterey OS 尝试启动一个 react-native 应用程序。

npx react-native init AwesomeProject 

给我:

✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./AwesomeProject/ios && pod install".
CocoaPods documentation: https://cocoapods.org/

当我尝试时

cd ./AwesomeProject/ios && pod install

我得到:

  664 /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/ffi.rb
  665 /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: https://www.ruby-lang.org/bugreport.html

[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.

zsh: abort      pod install

还有其他人遇到同样的问题吗?

编辑:

卸载并重新安装 Ruby 和 Cocoapods。

This was a helpful post

并使用:

arch -x86_64 pod install

使用该处理器确实会在安装 pods 时带来一些问题。请尝试 arch -x86_64 pod install 看看它带来了什么。 Link 一些年长的 post: React Native ios builds failing suddenly