在总共 48 个 gem(s) 中找不到 'cocoapods' (>= 0.a) (Gem::MissingSpecError)
Could not find 'cocoapods' (>= 0.a) among 48 total gem(s) (Gem::MissingSpecError)
Mac OS 10.15.7
ABCD-MBP:~ abcd$ which ruby
/usr/local/opt/ruby/bin/ruby
ABCD-MBP:~ abcd$ ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin19]
连播设置
Traceback (most recent call last):
3: from /usr/local/bin/pod:22:in `<main>'
2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:323:in `to_spec'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'cocoapods' (>= 0.a) among 48 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/abcd/.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
我不明白为什么旧版本的 ruby 会被引用到这里?
使用 XCode > pod 安装失败,因为旧版本的 ruby 也被引用。
Traceback (most recent call last):
3: from /usr/local/bin/pod:22:in `<main>'
2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:323:in `to_spec'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'cocoapods' (>= 0.a) among 48 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/abcd/.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
我尝试了 SO 中提出的不同解决方案,但无法解决这个问题
- 卸载所有 gem 并重新安装
- 卸载 pod 并重新安装
默认 Mac 的 ruby 版本与您安装的
版本不同时会出现此问题
我可以通过安装与 Mac OS ruby 框架相同的 ruby 版本来解决这个问题。
移除所有 gem,重新安装 pod。
参考资料
https://github.com/CocoaPods/CocoaPods/issues/10246#issuecomment-761719446
https://superuser.com/questions/340490/how-to-install-and-use-different-versions-of-ruby
-
-
-
Uninstall all installed gems, in OSX?
homebrew uninstall ruby
-
我想知道 Apple 工程师制作 pod 有什么乐趣 + ruby 这么复杂的东西要修复 :)
Mac OS 10.15.7
ABCD-MBP:~ abcd$ which ruby
/usr/local/opt/ruby/bin/ruby
ABCD-MBP:~ abcd$ ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin19]
连播设置
Traceback (most recent call last):
3: from /usr/local/bin/pod:22:in `<main>'
2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:323:in `to_spec'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'cocoapods' (>= 0.a) among 48 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/abcd/.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
我不明白为什么旧版本的 ruby 会被引用到这里?
使用 XCode > pod 安装失败,因为旧版本的 ruby 也被引用。
Traceback (most recent call last):
3: from /usr/local/bin/pod:22:in `<main>'
2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:323:in `to_spec'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'cocoapods' (>= 0.a) among 48 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/abcd/.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
我尝试了 SO 中提出的不同解决方案,但无法解决这个问题
- 卸载所有 gem 并重新安装
- 卸载 pod 并重新安装
默认 Mac 的 ruby 版本与您安装的
版本不同时会出现此问题我可以通过安装与 Mac OS ruby 框架相同的 ruby 版本来解决这个问题。 移除所有 gem,重新安装 pod。
参考资料
https://github.com/CocoaPods/CocoaPods/issues/10246#issuecomment-761719446
https://superuser.com/questions/340490/how-to-install-and-use-different-versions-of-ruby
Uninstall all installed gems, in OSX?
homebrew uninstall ruby
我想知道 Apple 工程师制作 pod 有什么乐趣 + ruby 这么复杂的东西要修复 :)