【问题标题】:flutter doctor - CocoaPods installed but not working颤振医生 - CocoaPods 已安装但无法正常工作
【发布时间】:2021-03-29 12:33:00
【问题描述】:

使用 zsh - 用于在 bash 中工作
brew doctor - 您的系统已准备好进行冲泡。
颤振医生给出这个错误

[!] Xcode - develop for iOS and macOS (Xcode 12.2)
    ✗ CocoaPods installed but not working.
        You appear to have CocoaPods installed but it is not working.
        This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
        This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
      To re-install CocoaPods, run:
        sudo gem install cocoapods  

sudo gem 安装 cocoapods

Gives this error  
dyld: Library not loaded: /usr/local/opt/gmp4/lib/libgmp.3.5.2.dylib  
  Referenced from: /Users/puser/.rvm/rubies/ruby-2.5.1/bin/ruby  
  Reason: image not found  
zsh: abort      sudo gem install cocoapods  

我无法纠正上述错误 - 有什么建议吗?

哪个吊舱

/Users/puser/.rvm/rubies/ruby-2.5.1/bin/pod

哪个宝石

gem () {
    \typeset result
    (
        \typeset rvmrc
        rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc") 
        if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
        then
            rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc") 
        fi
        for rvmrc in "${rvm_rvmrc_files[@]}"
        do
            [[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
        done
        unset rvm_rvmrc_files
        command gem "$@"
    ) || result=$? 
    hash -r
    return ${result:-0}
}

哪个红宝石

/Users/puser/.rvm/rubies/ruby-2.5.1/bin/ruby

【问题讨论】:

    标签: flutter cocoapods homebrew


    【解决方案1】:

    根据这篇文章的建议,我能够使用以下命令重新安装 cocoapods
    gem native extension error while installing cocoapods

    打开终端

    curl -L https://get.rvm.io | bash -s stable
    

    重新打开终端

    rvm install ruby-2.6
    
    rvm use ruby-2.6.5
    
    rvm --default use 2.6.5
    

    然后按预期安装了cocoapods

    sudo gem install cocoapods
    

    【讨论】:

    • 谢谢。这对我帮助很大。
    • 谢谢。你救我!我想给你额外的信息。如果你在 m1 上使用 Flutter。那么你应该像这样安装它。 rvm install ruby-2.6 --with-out-ext=fiddle 在我的情况下,安装的版本是 2.6.6。所以也许你改变了这个特定的版本。
    • 干杯!!几个小时后,这终于奏效了。
    • 谢谢。 rvm 网站建议使用\curl -sSL https://get.rvm.io | bash -s stable 下载,然后我安装了rvm install ruby-2.7.2 确保您没有使用 Homebrew 安装 CocoaPods,如果是,brew uninstall cocoapods。然后,rvm --default use 2.7.2sudo gem install cocoapods 为我工作
    【解决方案2】:
    curl -L https://get.rvm.io | bash -s stable
    rvm install ruby-2.6
    rvm use ruby-2.6.5
    rvm --default use 2.6.5
    sudo gem update
    sudo gem install ffi
    brew install libffi
    sudo gem install cocoapods
    pod setup
    

    这对我有用

    【讨论】:

      【解决方案3】:

      使用 brew 和 gem

      1. 先通过 gem 卸载

        sudo gem 卸载 cocoapods

      2. 通过 brew 安装 cocoapods

        brew 安装 cocoapods

      3. 使用 brew 链接

        brew 链接 --overwrite cocoapods

      【讨论】:

        【解决方案4】:

        sudo gem 卸载 cocoapods
        rvm 安装 2.6.5
        sudo gem 安装 cocoapods

        【讨论】:

          猜你喜欢
          • 2019-02-19
          • 2019-04-26
          • 2011-12-18
          • 2017-10-05
          • 2015-02-05
          • 2015-03-26
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多