在終端用gem命令的時(shí)候,時(shí)常遇到的問題:
-
墻墻墻
通過 gem source 查看你的當(dāng)前的gem資源庫位置,如果你的當(dāng)前資源庫的位置為: https://rubygems.org/,不好意思,你是無法安裝成功的,因?yàn)檫@個(gè)資源庫在國外,所以你需要安裝的githug是無法下載成功的,那我們怎么辦呢,其實(shí)方法很簡單,修改當(dāng)前資源庫的位置:1- gem sources -r https://rubygems.org/ 刪除原來的資源庫位置
2- gem sources -a https://ruby.taobao.org/ 添加新的資源庫位置
3- gem sources -u 更新資源庫 目錄權(quán)限不夠
報(bào)錯(cuò):
ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
解決:
sudo chmod 777 /Library/Ruby/Gems/2.0.0 修改權(quán)限gem需要更新
報(bào)錯(cuò):
ERROR: While executing gem … (Errno::EACCES)
Permission denied - /Library/Ruby/Gems/2.0.0/cache/i18n-0.7.0.gem
解決:
gem update –system如果還是不行,又想用gem安裝怎么辦?sudo gem install….