如何修复Cocoapods安装设置错误?

时间:2014-11-07 06:40:58

标签: ios iphone ruby ipad cocoapods

大家好!

我试图在我的Mac上安装cocoapods但我无法安装它,因为它显示以下错误

➜桌面$ sudo gem update --system

目前安装的最新版本。 中止。

➜桌面$ sudo gem install cocoapods 成功安装了cocoapods-0.34.4 解析cocoapods-0.34.4的文档 已安装1个宝石

➜桌面$ pod设置 /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in to_specs': Could not find 'cocoapods' (>= 0) among 200 total gem(s) (Gem::LoadError) Checked in 'GEM_PATH=/Users/(user name)/.rvm/gems/ruby-1.9.3-p374:/Users/vamshiraghu/.rvm/gems/ruby-1.9.3-p374@global', execute gem env for more information from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:324:in to_spec'     来自/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:58:in gem' from /usr/bin/pod:22:in'

那么有人知道这个错误要解决吗?

2 个答案:

答案 0 :(得分:4)

我有同样的问题。尝试不同的安装和卸载组合时,我遇到了不同的错误。像

[!] The `master` repo requires CocoaPods 0.32.1 - 

.rvm/gems/ruby-2.0.0-p598/gems/claide-0.4.0/lib/claide/command.rb:217:in `rescue in run': undefined method `verbose?' for nil:NilClass (NoMethodError)

    .rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require': cannot load such file -- colored (LoadError)
     from /Users/riverhuang/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
    from /Users/riverhuang/.rvm/gems/ruby-2.1.5@global/gems/cocoapods-0.36.2/lib/cocoapods/user_interface.rb:8:in `<module:UserInterface>'
    from /Users/riverhuang/.rvm/gems/ruby-2.1.5@global/gems/cocoapods-0.36.2/lib/cocoapods/user_interface.rb:7:in `<module:Pod>'
    .
    .
    .
    from /Users/riverhuang/.rvm/gems/ruby-2.1.5/bin/pod:23:in `load'
    from /Users/riverhuang/.rvm/gems/ruby-2.1.5/bin/pod:23:in `<main>'
    Could not find proper version of cocoapods (0.29.0) in any of the sources
    Run `bundle install` to install missing gems.

清除了计算机中的所有宝石后,我终于修复了它。这是我清除所有宝石的步骤。

gem uninstall --all
sudo gem uninstall --all

卸载所有宝石后,我重新安装了cocoapods。

sudo gem install cocoapods

然后重启终端并运行:

pod setup

我猜它在依赖宝石中存在冲突(错误的版本或不正确的路径)。就像我运行“捆绑安装”一样,它总是安装cocoapods 0.29.0及其所有依赖。有和没有“sodu”安装宝石及其依赖于版本0.36.2的不同地方,当我这样做。

答案 1 :(得分:0)

尝试直接运行这个命令

  1. sudo gem uninstall cocoapods
  2. gem install cocoapods
  3. pod install

使用默认的 Ruby 安装将要求您在安装 gems 时使用 sudo。 (不过,这只是 gem 安装期间的问题。)

了解更多:https://guides.cocoapods.org/using/getting-started.html