如何解决安装 cocoapods 的错误(nil:NilClass 的未定义方法 `invoke_with_build_args')?

sha*_*aka 6 cocoa cocoapods

我跑

sudo gem install cocoapods
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误。我正在尝试按照无法安装 Cocoapods - 在项目目录中找不到 podfile 中的说明进行操作,但由于无法通过此步骤而卡住了。

关于我会做什么的任何建议?

ERROR:  Loading command: install (LoadError)
    dlopen(/Users/sharatakasapu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Users/sharatakasapu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle
  Reason: image not found - /Users/sharatakasapu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass
Run Code Online (Sandbox Code Playgroud)

mon*_*717 3

我终于能够使用该网站的信息继续前进,简单地升级到新版本rbenv: https: //qiita.com/nya__str/items/eeddac3a122f0c251d88

# view versions available to install
rbenv install --list

# pick the latest version from the list and install it
rbenv install 2.7.2

# set as the new default
rbenv global 2.7.2

# try again
sudo gem install cocoapods

#   
Run Code Online (Sandbox Code Playgroud)

  • 在 `rbenv install 2.7.2` 之前,运行以下命令来升级 ruby​​-build:通过运行 `brew update && brew Upgrade ruby​​-build` (2认同)