flutter 扑动医生-CocoaPod已安装但不工作

dojqjjoe  于 2022-11-25  发布在  Flutter
关注(0)|答案(8)|浏览(283)

使用zsh -用于在bash中工作
brew doctor -您的系统已准备好进行酿造。
Flutter医生给出此错误

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

须藤宝石安装椰子

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}
}

该Ruby

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

abithluo1#

使用这篇文章的建议,我能够用下面的命令重新安装cocopods
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

然后这个安装cocopod如预期

sudo gem install cocoapods
fkvaft9z

fkvaft9z2#

使用酿造和宝石
1.首先由gem卸载
sudo gem卸载cocopods
1.安装椰子由酿造
酿造装置
1.链接使用brew
brew链接--覆盖cocopods

n6lpvg4x

n6lpvg4x3#

首先安装Mac的brew软件包管理器。https://brew.sh
如果您使用macOS,不建议使用系统Ruby。您也不应该使用它。它是用于系统特定用途的。您需要为用户安装另一个。

brew install rbenv

然后安装最新版本的ruby. as today its 3.1.0

rbenv install 3.1.0

然后将Ruby的全局版本设置为在所有shell中使用

rbenv global 3.1
    • 关闭终端并重新打开,**以影响更改。

最后装上椰子

gem install cocoapods

正如您所看到的,您没有使用sudo命令。因为您没有覆盖系统特定的配置。当您需要使用sudo命令时,意味着您正在执行一些您应该避免的操作。
如果您使用的是fastlane,即使cocoapods已正确安装,但仍然抱怨cocoapods,请重新安装fastlane

brew uninstall fastlane
gem install fastlane
beq87vna

beq87vna4#

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

这对我很有效

tzxcd3kk

tzxcd3kk5#

sudo gem卸载cocopods
rvm安装2.6.5
须藤宝石安装椰子

q3qa4bjr

q3qa4bjr6#

我正在使用MacBook Pro(2020)与M1和以下步骤工作

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

rvm install ruby-2.6

rvm reinstall ruby-2.6.6 

rvm use ruby-2.6.6

rvm --default use 2.6.6

sudo gem install cocoapods

最后,您可以运行扑动医生进行确认。

flutter doctor

输出将如下所示...

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.4 21F79 darwin-arm, locale
    en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version
    32.0.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.68.1)
[✓] Connected device (1 available)
[✓] HTTP Host Availability
8oomwypt

8oomwypt7#

请安装最新版本的ruby以解决此问题。使用以下命令

rvm install ruby

rvm use ruby

rvm --default use
1cosmwyk

1cosmwyk8#

sudo gem install -n /usr/local/bin cocoapods

只需运行此命令即可安装最新版本的coc

相关问题