简体   繁体   English

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

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

Command i am running is我正在运行的命令是

brew install cocoapods     

Warning: cocoapods 1.11.2_2 is already installed and up-to-date.警告:cocoapods 1.11.2_2 已经安装并且是最新的。 To reinstall 1.11.2_2, run: brew reinstall cocoapods ~ % alias pod='arch -x86_64 pod'要重新安装 1.11.2_2,请运行: brew reinstall cocoapods ~ % alias pod='arch -x86_64 pod'

Below is error:下面是错误:

/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>'

I Uninstall and install RUBY and COCOPODS again.我再次卸载并安装 RUBY 和 COCOPODS。 and now below is the error:现在下面是错误:

/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>'

I solved this by removing cocoapod and installing it again我通过删除 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

Try deleting your yarn.lock or package.lock file.尝试删除您的 yarn.lock 或 package.lock 文件。 hopefully, that works.希望,这行得通。

if that doesn't work, try rvm install ruby-3.1.1 rvm --default use ruby-3.1.1如果这不起作用,请尝试rvm install ruby-3.1.1 rvm --default use ruby-3.1.1

Cocoa-pods Install in M1 Cocoa-pods 安装在 M1 中

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

Here how its works.这是它的工作原理。

Copy & Run this command in terminal在终端中复制并运行此命令

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

If you get any warning like(Warning: /opt/homebrew/bin is not in your PATH. Instructions on how to configure your shell for Homebrew can be found in the 'Next steps' section below.) then please ignore these two commands.如果您收到任何警告,例如(警告:/opt/homebrew/bin 不在您的 PATH 中。有关如何为 Homebrew 配置 shell 的说明可以在下面的“下一步”部分中找到。)然后请忽略这两个命令。

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

Now Install Cocoapods现在安装 Cocoapods

brew install cocoapods

Now Install pods, locate the project现在安装 pod,找到项目

Pod install

DONE完毕

I was having this same issue when running pod install , NOT during the installation of Cocoapods.我在运行pod install时遇到了同样的问题,而不是在安装 Cocoapods 期间。 This GitHub comment helped me solve it. 这个GitHub 评论帮助我解决了这个问题。 I was using ruby 3.0.0.我使用的是 ruby 3.0.0。 I installed 3.0.3, followed by Cocoapods, and then pod install started working.我安装了 3.0.3,然后是 Cocoapods,然后pod install开始工作。

I ran into the same error.我遇到了同样的错误。 I'm using rvm (RubyVersionManager).我正在使用 rvm (RubyVersionManager)。 Make sure that you're using the same version of Ruby as when you first ran the install.确保您使用与第一次运行安装时相同的 Ruby 版本。 If you're running the install for the first time, make sure that you're not using the system version of Ruby (It's a very old version).如果您是第一次运行安装,请确保您没有使用 Ruby 的系统版本(这是一个非常旧的版本)。

In my case, I was trying to run pod install on version 3.0.0, but I should've been running it on 3.1.2, changing my version fixed the issue.就我而言,我试图在 3.0.0 版本上运行 pod install,但我应该在 3.1.2 上运行它,更改我的版本解决了这个问题。

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

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