Mac安装Cocoapods报错汇总

2020-11-20  本文已影响0人  superlaing

一. pod安装

sudo gem install cocoapods

二. 错误

1. Traceback错误

Traceback (most recent call last):
 4: from /Users/iosdev/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
 3: from /Users/iosdev/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
 2: from /usr/local/bin/pod:23:in `<main>'
 1: from /Users/iosdev/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/Users/iosdev/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)

解决:

1、sudo gem update --system
2、gem install cocoapods

2. ruby错误(或者未安装)

安装ruby首先要安装rvm

\curl -sSL https://get.rvm.io | bash -s stable

查找ruby版本
rvm list known 或者去官网:https://www.ruby-lang.org/en/downloads/

安装ruby

rvm install +版本号`,例如 rvm install 2.7.2

安装完ruby,在安装pod如果还报错,可能需要

rvm reload

安全证书错误

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

解决:

参考
https://bundler.io/v2.0/guides/rubygems_tls_ssl_troubleshooting_guide.html#troubleshooting-certificate-errors

Start by running the automatic SSL check, and follow the instructions. You might need to update Bundler, update RubyGems, manually update RubyGems certificates, or perhaps even install new OS certificates.

下载.gem文件安装到钥匙串

3. gem 错误

安装完后提示pod: command not found
解决:

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

gem source问题:

gem sources -a https://gems.ruby-china.org/
或者
gem sources -a https://rubygems.org/

如果还有其他各种错误,直接无脑操作,卸载pod,重新安装pod,按部就班就好了

上一篇下一篇

猜你喜欢

热点阅读