无法在 MacBook M1 上通过 Bundler 安装 CocoaPods

时间:2021-07-07 14:57:36

标签: ios ruby macos cocoapods bundler

我正在尝试通过 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>’

1 个答案:

答案 0 :(得分:0)

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