如何使用 Rosetta 在 Mac 上解决“react-native”和 cocopods 的错误

mur*_*rty 6 macos rosetta cocoapods react-native

我正在尝试使用应用程序芯片在新的 Mac 计算机上执行反应本机项目。按照某些论坛的建议,将终端更改为使用 Rosetta 打开

使用 NPM 14.16.0 安装了 cocoa pods 1.10.1 版本并反应 Native 版本 0.63.4 和 Xcode 版本 12.4 并尝试在 iOS 文件夹中运行 pod install 命令。我收到以下错误。

错误

[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `react_native_post_install' for #<Pod::Podfile:0x00000001572d90f8>

/Users/vvvvv/WebstormProjects/Reer/ios/Podfile:27:in `block (3 levels) in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:897:in `run_podfile_post_install_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:885:in `block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:884:in `run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:329:in `block (2 levels) in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:328:in `block in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:307:in `create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:299:in `generate_pods_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:178:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:166:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Run Code Online (Sandbox Code Playgroud)

感谢任何帮助。

Fra*_*son 10

tldr:更新您的版本react-native以匹配您的 Podfile。

react_native_post_install引入于"react-native": "0.64.0".

对我来说,我已经"react-native": "~0.63.4"安装了,但使用的是 0.64 新版的 Podfile(复制/粘贴)reactive-native init

我经历了将我的博览会创建的项目转移到原始反应原生的过程。

  • 我将react-native升级到0.64.0并且它起作用了,谢谢 (3认同)
  • 升级到 0.64.0 后问题已解决 (2认同)