cocopods ruby报错 Traceback (most recent call last):

报错信息

Traceback (most recent call last):
    17: from /Users/john.lee/.rvm/gems/ruby-2.7.0-preview1/bin/ruby_executable_hooks:24:in `
' 16: from /Users/john.lee/.rvm/gems/ruby-2.7.0-preview1/bin/ruby_executable_hooks:24:in `eval' 15: from /Users/john.lee/.rvm/gems/ruby-2.7.0-preview1/bin/pod:25:in `
' 14: from /Users/john.lee/.rvm/gems/ruby-2.7.0-preview1/bin/pod:25:in `load' 13: from /Users/john.lee/.rvm/gems/ruby-2.7.0-preview1/gems/cocoapods-1.11.3/bin/pod:36:in `' 12: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require' 11: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require' 10: from /Users/john.lee/.rvm/gems/ruby-2.7.0-preview1/gems/cocoapods-1.11.3/lib/cocoapods.rb:9:in `' 9: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require' 8: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require' 7: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/conversions.rb:3:in `' 6: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require' 5: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require' 4: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/xml_mini.rb:11:in `' 3: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/xml_mini.rb:17:in `' 2: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/xml_mini.rb:94:in `' 1: from /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/delegation.rb:244:in `delegate' /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/delegation.rb:244:in `module_eval': /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/xml_mini.rb:94: syntax error, unexpected (..., expecting ')' (SyntaxError) def parse(...); _ = backend; _.parse(...... ^~~ /Users/john.lee/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/xml_mini.rb:94: syntax error, unexpected ')' ....); _ = backend; _.parse(...);rescue NoMethodError => e; ... ...

问题原因:版本的问题,更换下版本。

我的解决步骤如下:

1.通过rvm list known查看下ruby的版本列表
2.再通过rvm use ruby-2.7.0 --default 设置某个为默认的版本
3.然后我执行pod,发现又报错了,报错如下:
Traceback (most recent call last):
    4: from /Users/john.lee/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:22:in `
' 3: from /Users/john.lee/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:22:in `eval' 2: from /usr/local/bin/pod:23:in `
' 1: from /Users/john.lee/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path' /Users/john.lee/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException) -------------*********************---------- 提示为gem不能找到cocopods,不能执行 4. 执行gem source 查找当前源 我的是https://gems.ruby-china.com 没有问题,有多余的可以删掉 5.执行更新sudo gem update --system 6. 安装cocopods sudo gem install -n /usr/local/bin cocoapods

你可能感兴趣的:(cocopods ruby报错 Traceback (most recent call last):)