美文网首页IosiOS自学iOS Developer
cocoapods升级失败的解决办法

cocoapods升级失败的解决办法

作者: 千煌89 | 来源:发表于2015-12-14 18:24 被阅读388次

    今天使用cocoapods,看见提示我cocoapods更新的信息。

    /usr/bin/pod install

    Updating local specs repositories

    CocoaPods 0.39.0 is available.
    To update use: gem install cocoapods
    Until we reach version 1.0 the features of CocoaPods can and will change.
    We strongly recommend that you use the latest version at all times.

    好的,那我们就来更新cocoapods

     ~ ⮀ gem install cocoapods
    ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
              Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
    

    咦,我一直这么用的啊怎么不好用了?翻了翻cocoapods语法也没问题,仔细看看error,是不是淘宝的source不好用了,被删了?

    上淘宝镜像一看

    原来是升级到https了,那么就要更换ruby的source了。

     ~ ⮀ gem sources --remove http://ruby.taobao.org/
    http://ruby.taobao.org/ removed from sources
     ~ ⮀ gem sources -a https://ruby.taobao.org/
    https://ruby.taobao.org/ added to sources
     ~ ⮀ gem source -l
    *** CURRENT SOURCES ***
    
    https://ruby.taobao.org/
    

    删掉旧的source,添加新的,然后升级gem,再升级cocoapods。

     ~ ⮀ sudo gem update --system
    //结果太长省略
     ~ ⮀ sudo gem install cocoapods
    //结果太长省略
     ~ ⮀ pod setup
    Setting up CocoaPods master repo
    Updating 0a4155d..0ce9f4a
    Fast-forward
     .../0.0.4/CommonTableCollectView.podspec.json      | 24 ++++++++++++++++++++++
     1 file changed, 24 insertions(+)
     create mode 100644 Specs/CommonTableCollectView/0.0.4/CommonTableCollectView.podspec.json
    From https://github.com/CocoaPods/Specs
       0a4155d..0ce9f4a  master     -> origin/master
    Setup completed
     ~ ⮀ pod --version
    0.39.0
    

    还有就是安装cocoapods没有权限的时候,本来是$sudo gem install cocoapods ,但是显示没有权限,换成这句$sudo gem install -n /usr/local/bin cocoapods
    ERROR: While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/pod
    bogon:~ my$ sudo gem install -n /usr/local/bin cocoapods

    相关文章

      网友评论

        本文标题:cocoapods升级失败的解决办法

        本文链接:https://www.haomeiwen.com/subject/jmjuhttx.html