今天更新cocoapods版本的时候,安装会报出一个奇怪的错误
sudo gem install cocoapods
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://gems.ruby-china.org/ - bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
通过查找原因发现:sources 里面镜像链接 https://gems.ruby-china.org
被弃用:
Screen Shot 2019-03-06 at 4.49.04 PM.png
需要重新换一下源:
gem sources --remove https://gems.ruby-china.org/
gem sources --add https://gems.ruby-china.com/
gem sources --list
*** CURRENT SOURCES ***
https://gems.ruby-china.com/
然后重新安装一下即可
sudo gem install cocoapods
如果有人遇到类似的问题,希望对你有所帮助。