我嘗試使用“sudo gem install cocoapods”更新 cocoapods,據說已經安裝了最新的 cocoapods。但是,當我運行“pod --version”時,它仍然顯示該版本是我之前的 cocoapods 版本。有關如何更新到最新版本的任何建議?
xx@xx-MacBook-Air ios % sudo gem install cocoapods
Password:
Successfully installed cocoapods-1.11.3
Parsing documentation for cocoapods-1.11.3
Done installing documentation for cocoapods after 1 seconds
1 gem installed
xx@xx-MacBook-Air ios % pod setup
Setup completed
xx@xx-MacBook-Air ios % pod --version
1.10.1
我嘗試使用以下代碼按照此建議卸載 cocoapods 并重新安裝它:
xx@xx-MacBook-Air ios % sudo gem uninstall cocoapods
Remove executables:
pod, sandbox-pod
in addition to the gem? [Yn] y
Removing pod
Removing sandbox-pod
Successfully uninstalled cocoapods-1.11.3
xx@xx-MacBook-Air ios % pod --version
1.10.1
xx@x-MacBook-Air ios % sudo gem uninstall cocoapods
Gem 'cocoapods' is not installed
xx@xx-MacBook-Air okepos % sudo gem install cocoapods
Fetching cocoapods-1.11.3.gem
Successfully installed cocoapods-1.11.3
Parsing documentation for cocoapods-1.11.3
Installing ri documentation for cocoapods-1.11.3
Done installing documentation for cocoapods after 2 seconds
1 gem installed
xx@xx-MacBook-Air ios % pod --version
1.10.1
但即使在我卸載 cocopods 之后, pod --version 仍然顯示以前的版本。我嘗試再次重新安裝最新版本,但版本仍然顯示 1.10.1
uj5u.com熱心網友回復:
用于which pod確定它的安裝位置。很可能是 through brew,因此您需要執行 abrew upgrade以獲得最新版本。通常,最好通過相同的方法安裝所有 Ruby 工具:直接、通過brew或使用 Ruby 管理器(如rvm.
uj5u.com熱心網友回復:
sudo gem install cocoapods
停在那兒。你不得不說的事實sudo就是問題所在。這表明您正在嘗試將 gem 安裝到 System ruby?? 中。你不能那樣做。
使用 homebrew 安裝rbenv和使用rbenv來配置你自己的全域 ruby??。從現在開始使用它,別無其他。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/477157.html
