ios Ruby 2.7 brew和Ruby 2.6从操作系统上的机器...我只想要2.7

mm5n2pyu  于 2023-03-20  发布在  iOS
关注(0)|答案(1)|浏览(204)

我正试图让一个iOS应用程序通过capacitorjs工作。
我已经通过Brew安装了最新的Ruby。
但现在似乎有一个问题,那就是cocopods一直试图使用旧的ruby(随操作系统安装和发货)。
建议更新ruby和可可pod ...但是现在“pod install”引用的是ruby 2.6而不是新的2.7版本。

pod --version 
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'ffi' (>= 1.15.0) among 81 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/me/.gem/ruby/2.6.0:/Library/Ruby/Gems/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0', execute `gem env` for more information
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1449:in `block in activate_dependencies'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `activate_dependencies'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1420:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1452:in `block in activate_dependencies'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `activate_dependencies'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1420:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1452:in `block in activate_dependencies'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `activate_dependencies'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1420:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1452:in `block in activate_dependencies'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `activate_dependencies'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1420:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:304:in `block in activate_bin_path'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:303:in `synchronize'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
    from /usr/local/bin/pod:23:in `<main>'

当我运行ruby on cli时,显示2个版本:

which -a ruby
/opt/homebrew/opt/ruby@2.7/bin/ruby
/usr/bin/ruby

当运行ruby版本时,比如说2.7:

ruby --version
ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [arm64-darwin22]

这是一个令人困惑的,但感觉像cocopods是配置在某处使用旧版本,而不是新版本?
有人能告诉我如何让pod使用安装的新版本吗?
我原以为安装ruby 2.7、导出path var并重新启动机器就可以解决链接问题,但没有什么用。

wlzqhblo

wlzqhblo1#

在GitHub上看看这个issue
基本上,原因是bin文件夹中的cocopods由于某种原因没有更新,并且引用了系统的gem 2.6版本。
删除这个版本的Pod,然后允许操作系统拾取Brew安装的新版本。
您无需安装或配置https://github.com/rbenv/rbenv#basic-git-checkout

相关问题