1武学、最近在使用cocoapods時出現(xiàn)下面的報錯:
ERROR:? SSL verification error at depth 0: certificate has expired (10)ERROR:? Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02ZERROR:? SSL verification error at depth 0: certificate has expired (10)ERROR:? Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02ZERROR:? SSL verification error at depth 0: certificate has expired (10)ERROR:? Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02ZERROR:? Could not find a valid gem 'cocoapods' (= 1.5.0), here is why:? ? ? ? ? Unable to download data from https://ruby.taobao.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired) (https://ruby.taobao.org/specs.4.8.gz)ERROR:? SSL verification error at depth 0: certificate has expired (10)ERROR:? Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02ZERROR:? SSL verification error at depth 0: certificate has expired (10)ERROR:? Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02Z
出現(xiàn)這個的原因是因為原來淘寶的ruby源無法使用了
我們先刪除原來的ruby源:gem sources --remove?https://ruby.taobao.org/
然后添加新的ruby源: gem sources -a?https://gems.ruby-china.com/?
gem sources 查看當前ruby源狀態(tài)是否替換成功
最后?sudo gem install -n /usr/local/bin cocoapods -v 1.5.3(任意版本)升級或降級到自己需要的版本
2、什么是gem
Gem是一個管理Ruby庫和程序的標準包舌缤,它通過Ruby Gem(如 http://rubygems.org/)源來查找妹田、安裝萌狂、升級和卸載軟件包,非常的便捷穿扳。
常用的命令有:
$ gem --version (查看gem版本)
$ gem update --system(更新gem)
$ gem sources (查看數(shù)據(jù)源)
$ gem sources --remove??https://rubygems.org/(刪除數(shù)據(jù)源)
$ gem sources -a https://ruby.taobao.org/(添加數(shù)據(jù)源)
$ gem search 軟件包關鍵字(搜索軟件包)
$ gem install 軟件包名稱(安裝軟件包)
$ gem install cocoapods --pre(安裝上一個版本軟件包)
$ gem uninstall 軟件包名稱(卸載安裝包)