flutter doctor - CocoaPods 已安装但无法工作

2024-01-01

使用 zsh - 用于在 bash 中工作
酿造医生 - 您的系统已准备好酿造。
颤振医生给出了这个错误

[!] 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

使用这篇文章的建议,我能够使用以下命令重新安装 cocoapods
安装 cocoapods 时出现 gem 本机扩展错误 https://stackoverflow.com/questions/60585707/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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

flutter doctor - CocoaPods 已安装但无法工作 的相关文章

随机推荐