【问题标题】:Can't Install CocoaPods via Bundler on MacBook M1 [duplicate]无法在 MacBook M1 上通过 Bundler 安装 CocoaPods [重复]
【发布时间】:2021-09-18 03:22:04
【问题描述】:

我正在尝试通过 Bundler 在 MacBook Air M1 上安装 CocoaPods,但一直收到此错误消息。我正在使用 Rosetta Terminal,但它没有帮助。

命令:

bundler exec pod install

堆栈:

CocoaPods : 1.10.1  
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580 [universal.x86_64-darwin20]  
RubyGems : 3.0.3  
Host : macOS 11.4 (20F71)  
Xcode : 12.5.1 (12E507)  
Git : git version 2.30.1 (Apple Git-130)  
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib  

错误

LoadError - dlopen(/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
    /Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture
    /Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture - /Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in `require’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in `rescue in <top (required)>’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:3:in `<top (required)>’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ethon-0.13.0/lib/ethon.rb:3:in `require’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ethon-0.13.0/lib/ethon.rb:3:in `<top (required)>’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `require’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:440:in `require’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async’
...
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.7/exe/bundle:37:in `<top (required)>’
/usr/local/bin/bundle:23:in `load’
/usr/local/bin/bundle:23:in `<main>’

【问题讨论】:

  • 我不使用bundler,所以我不是 100% 确定,但没有它我收到了类似的信息。 TL;DR 预装的 ruby​​ 版本非常过时,通过 brew 更新它为我修复了它。看到这个答案:stackoverflow.com/a/66556339/1185169
  • @SimonMcLoughlin 我尝试遵循这个答案并将 ruby​​ 升级到 3.0.1,但随后 Bundler 返回错误 google-api-client-0.38.0 requires ruby ​​version ~&gt; 2.4, which is incompatible with the current version, ruby ​​3.0.1p64
  • 我不使用也不知道捆绑软件是什么。一个快速的谷歌说 google-api-client v0.38 也非常旧。最新版本是 0.53.0。我不知道您设置的哪一部分正在使用该库,但请尝试更新该库的版本,或者在他们的 github 上抱怨。试图弄清楚如何使用旧版本的 ruby​​ 不是我建议遵循的路径。如果不是 100% 需要 bundler,也许尝试安装最新的 ruby​​ 并使用不带 bundler 的 cocoapods
  • @SimonMcLoughlin 我试图更新所有库并一次又一次地运行 pod install 我从帖子中得到一个错误,这很奇怪
  • 我厌倦了一堆不同的工具和解决方案。当我找到上面的链接时,我所做的是卸载所有东西(卸载 ruby​​ 工具,卸载 cocoapods,卸载额外版本的 ruby​​)。然后我打开了一个没有罗塞塔的新终端。安装 brew,安装 ruby​​,安装 cocoapods(没有捆绑器或任何兼容模式),然后在项目目录中执行 pod install。没有额外的工具、设置或兼容模式

标签: ios ruby macos cocoapods bundler


【解决方案1】:

可以在这篇文章中找到答案:stackoverflow.com/a/66556339/1185169
就我而言,主要问题是本地安装的 ruby​​ 版本 v2.7.2。必须使用 v2.7.3 或更新版本

【讨论】:

    猜你喜欢
    • 2022-07-01
    • 1970-01-01
    • 2021-04-03
    • 2021-05-20
    • 2022-01-17
    • 2021-09-10
    • 1970-01-01
    • 2022-08-17
    相关资源
    最近更新 更多