美文网首页
执行pod repo update报错:Failed to co

执行pod repo update报错:Failed to co

作者: 安静守护你 | 来源:发表于2018-11-06 10:12 被阅读3768次

    现象描述

    在iOS项目中引入RN库的时候,执行pod install提示以下错误:

    Analyzing dependencies
    Fetching podspec for `React` from `./React/node_modules/react-native`
    Fetching podspec for `yoga` from `./React/node_modules/react-native/ReactCommon/yoga`
    [!] Unable to satisfy the following requirements:
    
    - `React/BatchedBridge (from `./React/node_modules/react-native`)` required by `Podfile`
    
    None of your spec sources contain a spec satisfying the dependency: `React/BatchedBridge (from `./React/node_modules/react-native`)`.
    
    You have either:
     * out-of-date source repos which you can update with `pod repo update`.
     * mistyped the name or version.
     * not added the source repo that hosts the Podspec to your Podfile.
    
    Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
    

    然后执行pod repo update报错如下:

    Updating spec repo `master`
    [!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down
    

    大体意思就是说连接失败,检查是否是网络问题

    解决方案

    升级 ruby 到最新版本; 然后升级 cocoaPods 到最新版本
    // 升级ruby:
    brew update
    brew install ruby
    
    // 升级cocoaPods:
    sudo gem install cocoapods
    

    如果报错,可以尝试如下:
    1、更新gem:sudo gem update --system
    2、删除gem源:gem sources --remove https://ruby.taobao.org/
    3、修改gem源:gem sources -a https://gems.ruby-china.com
    4、查看gem源是否是最新的:gem sources -l
    5、升级cocoapods:sudo gem install -n /usr/local/bin cocoapods --pre
    6、查看升级后的cocoapods版本:pod --version

    当查看gem源时执行gem sources -l显示应该是:

    *** CURRENT SOURCES ***
    
    https://gems.ruby-china.com
    

    有且仅有一个源,如果没有显示源链接,则执行修改gem源操作

    提示
    原来的源为https://gems.ruby-china.org,但是由于备案问题,其域名改为了.com,即https://gems.ruby-china.com

    相关文章

      网友评论

          本文标题:执行pod repo update报错:Failed to co

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