Could not find 'minitest' (>= 5.1) among 39 total gem(s) (Gem::MissingSpecError)

  • 執(zhí)行pod install 報(bào)錯(cuò):

Could not find 'minitest' (>= 5.1) among 39 total gem(s) (Gem::MissingSpecError)

  • 終端詳細(xì)信息:

/Library/Ruby/Site/2.6.0/rubygems/specification.rb:1413:in `rescue in block in activate_dependencies': Could not find 'minitest' (>= 5.1) among 39 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/myg/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/usr/local/Cellar/cocoapods/1.11.3/libexec' at: /usr/local/Cellar/cocoapods/1.11.3/libexec/specifications/activesupport-6.1.5.gemspec, execute `gem env` for more information
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1410:in `block in activate_dependencies'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1399:in `each'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1399:in `activate_dependencies'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1381:in `activate'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1417:in `block in activate_dependencies'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1399:in `each'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1399:in `activate_dependencies'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1381:in `activate'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1417:in `block in activate_dependencies'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1399:in `each'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1399:in `activate_dependencies'
    from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1381:in `activate'
    from /Library/Ruby/Site/2.6.0/rubygems.rb:286:in `block in activate_bin_path'
    from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `synchronize'
    from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `activate_bin_path'
    from /usr/local/Cellar/cocoapods/1.11.3/libexec/bin/pod:23:in `<main>'
/Library/Ruby/Site/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'minitest' (>= 5.1) among 39 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/myg/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/usr/local/Cellar/cocoapods/1.11.3/libexec' , execute `gem env` for more information
    from 
  • 1.解決辦法

先卸載掉homebrew里面的cocoapods:
brew uninstall cocoapods

然后再用gem的方式安裝:
sudo gem install cocoapods

如果不報(bào)錯(cuò)就可以直接 pod install了


如果報(bào)錯(cuò),看下邊:

  • 問(wèn)題2:輸入密碼后發(fā)現(xiàn)又特么報(bào)錯(cuò) :While executing gem ... (Gem::FilePermissionError)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
mayonggang@mayonggang ~ % 
  • 解決問(wèn)題2:指定的ruby路徑不對(duì),應(yīng)當(dāng)使用更新版本的ruby
    安裝rbenv
    指定使用rbenv的gem來(lái)執(zhí)行

    • 安裝rbenv
$ rbenv install -l
$ rbenv install -l
2.6.10
2.7.6
3.0.4
3.1.2
jruby-9.3.4.0
mruby-3.0.0
rbx-5.0
truffleruby-22.1.0
truffleruby+graalvm-22.1.0
  • -最新的是3.1.2。但是我下載失敗,換成了3.1.1就沒(méi)事兒了
$ rbenv install 3.1.1
    • 指定ruby 版本
$ rbenv global 3.1.1
$ rbenv rehash
    • 查找gem路徑
$ rbenv which gem
/Users/用戶名/.rbenv/versions/3.1.1/bin/gem
    • 添加相關(guān)路徑到PATH中
$ export PATH="$HOME/.rbenv/versions/3.1.1/bin:$PATH"

然后再次 :sudo gem install cocoapods就可以了

$ sudo gem install cocoapods
Password:
Fetching colored2-3.1.2.gem
Fetching claide-1.1.0.gem
Fetching CFPropertyList-3.0.5.gem
Fetching xcodeproj-1.21.0.gem
Fetching ruby-macho-2.5.1.gem
Fetching nanaimo-0.3.0.gem
Fetching atomos-0.1.3.gem
Fetching nap-1.1.0.gem
Fetching molinillo-0.8.0.gem
Fetching gh_inspector-1.1.3.gem
Fetching fourflusher-2.3.1.gem
Fetching escape-0.0.4.gem
Fetching cocoapods-try-1.2.0.gem
Fetching netrc-0.11.0.gem
。。。

然后就可以開心的pod install 了

如果有些常見的SDK找不到,

[!] Unable to find a specification for .....
或者
[!] Unable to find a pod with name, author, summary, or description matching `....`

那可能是需要更新一下pod

$ pod update

運(yùn)行pod install時(shí),如果在最后報(bào)錯(cuò):

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

No such file or directory - python

/Users/myg/Desktop/P_gitee/1.數(shù)字北京/Podfile:139:in ``'
/Users/myg/Desktop/P_gitee/1.數(shù)字北京/Podfile:139:in `block (3 levels) in from_ruby'
/Users/myg/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/Users/myg/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:945:in `run_podfile_post_install_hook'
    • 處理方法:
      我的提示語(yǔ)是沒(méi)有python這個(gè)文件路徑,
      我去Podfile中搜索了一下output =python #{root_path}/DS_BeiJing/Third/BaiDuAI/scheme_desc_collector.py #{root_path}`
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容