繁体   English   中英

在 Apple Silicon (M1) 中安装 pod 时出错

[英]Error while installing pod in Apple Silicon (M1)

我正在运行的命令是

brew install cocoapods     

警告:cocoapods 1.11.2_2 已经安装并且是最新的。 要重新安装 1.11.2_2,请运行: brew reinstall cocoapods ~ % alias pod='arch -x86_64 pod'

下面是错误:

/opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver/conflict.rb:47:in `conflicting_dependencies': undefined method `request' for nil:NilClass (NoMethodError)

    [@failed_dep.dependency, @activated.request.dependency]
                                       ^^^^^^^^
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/exceptions.rb:61:in `conflicting_dependencies'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/exceptions.rb:55:in `initialize'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver.rb:193:in `exception'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver.rb:193:in `raise'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver.rb:193:in `rescue in resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver.rb:191:in `resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/request_set.rb:411:in `resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/request_set.rb:423:in `resolve_current'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems.rb:230:in `finish_resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems.rb:287:in `block in activate_bin_path'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems.rb:285:in `synchronize'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems.rb:285:in `activate_bin_path'
    from /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/bin/pod:25:in `<main>'
/opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:317:in `raise_error_unless_state': Unable to satisfy the following requirements: (Gem::Resolver::Molinillo::VersionConflict)

- `minitest (= 5.14.2)` required by `user-specified dependency`
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'
    from <internal:kernel>:90:in `tap'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:682:in `attempt_to_activate'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:254:in `process_topmost_state'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:182:in `resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolver.rb:43:in `resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/resolver.rb:190:in `resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/request_set.rb:411:in `resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/request_set.rb:423:in `resolve_current'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems.rb:230:in `finish_resolve'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems.rb:287:in `block in activate_bin_path'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems.rb:285:in `synchronize'
    from /opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems.rb:285:in `activate_bin_path'
    from /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/bin/pod:25:in `<main>'

我再次卸载并安装 RUBY 和 COCOPODS。 现在下面是错误:

/Library/Ruby/Site/2.6.0/rubygems.rb:265:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
    from /Library/Ruby/Site/2.6.0/rubygems.rb:284:in `activate_bin_path'
    from /usr/local/bin/pod:23:in `<main>'

我通过删除 cocoapod 并再次安装解决了这个问题

gem cleanup
brew uninstall cocoapods
sudo gem uninstall cocoapods
sudo gem install cocoapods -n /usr/local/bin
sudo gem install cocoapods-user-defined-build-types
pod install --repo-update

尝试删除您的 yarn.lock 或 package.lock 文件。 希望,这行得通。

如果这不起作用,请尝试rvm install ruby-3.1.1 rvm --default use ruby-3.1.1

Cocoa-pods 安装在 M1 中

我使用 HomeBrew https://brew.sh/

这是它的工作原理。

在终端中复制并运行此命令

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

如果您收到任何警告,例如(警告:/opt/homebrew/bin 不在您的 PATH 中。有关如何为 Homebrew 配置 shell 的说明可以在下面的“下一步”部分中找到。)然后请忽略这两个命令。

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/shourob.datta/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

现在安装 Cocoapods

brew install cocoapods

现在安装 pod,找到项目

Pod install

完毕

我在运行pod install时遇到了同样的问题,而不是在安装 Cocoapods 期间。 这个GitHub 评论帮助我解决了这个问题。 我使用的是 ruby 3.0.0。 我安装了 3.0.3,然后是 Cocoapods,然后pod install开始工作。

我遇到了同样的错误。 我正在使用 rvm (RubyVersionManager)。 确保您使用与第一次运行安装时相同的 Ruby 版本。 如果您是第一次运行安装,请确保您没有使用 Ruby 的系统版本(这是一个非常旧的版本)。

就我而言,我试图在 3.0.0 版本上运行 pod install,但我应该在 3.1.2 上运行它,更改我的版本解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM