pod install 報錯: can’t find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
(error handling, cocoapods, pod install)
執行pod install時,出現下圖錯誤
/usr/local/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:281:in `find_spec_for_exe’: can’t find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
from /usr/local/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:300:in `activate_bin_path’
from /usr/local/bin/pod:23:in `<main>’
因使用 brew 安裝工具導致 ruby 環境參數錯亂
執行 pod install 時報錯提示找不到 gem 可執行文件
重新安裝cocoapods套件可解決
裝cocoapods套件
brew reinstall cocoapods
如果出現下圖錯誤訊息
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/pod
Target /usr/local/bin/pod
already exists. You may want to remove it:
rm ‘/usr/local/bin/pod’
解決衝突文件
brew link --overwrite cocoapods
再次執行即可使用