2011-10-09 35 views
4

我有一个Ruby on Rails的应用程序,用来工作。我在一个月左右没有使用它,但随后尝试启动它,今天与rails s并得到以下错误 - 事实上,当我尝试rails -hrails -v或甚至gem -hsudo gem update --system或任何必须做的时出现此错误与gem宝石和/或Ruby on Rails突然爆发,任何人都知道发生了什么事?

NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. 
Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8/specifications/rubygems-update-1.8.2.gemspec:11. 
Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z" 
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. 
Gem::Specification#default_executable= called from /Users/me/.gem/ruby/1.8/specifications/json-1.5.1.gemspec:10. 
/Library/Ruby/Site/1.8/rubygems/specification.rb:277:in `_resort!': undefined method `name' for nil:NilClass (NoMethodError) 
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:276:in `sort!' 
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:276:in `_resort!' 
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:270:in `_all' 
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:402:in `each' 
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:216:in `find_all' 
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:216:in `matching_specs' 
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:238:in `to_specs' 
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:256:in `to_spec' 
    from /Library/Ruby/Site/1.8/rubygems.rb:1182:in `gem' 
    from /usr/bin/rails:18 

任何人都知道发生了什么事以及如何解决它?如何卸载这一切,并重新安装(不卸载我的操作系统,男人会实在太烂)

+0

另外,我跑了“sudo的创业板更新轨”对在此之前爆发,即使我已经安装了护栏。 (我想更新它。)我猜这与它有关。 – Dave

回答

12

我会尝试通过运行

rm -rf ~/.gems 
sudo rm -rf /Library/Ruby/Gems/* 

gem list后应列出没有宝石清理你的所有已安装的宝石。然后运行

sudo gem update --system 

确保Ruby Gems处于最新版本。您将不得不重新安装所有的宝石。 (可能gem install bundler后跟bundle install)。

顺便说一下,您应该检查出rbenvrvm来管理Ruby版本,并保持所有开发宝石与系统Ruby分开。

+1

我希望我可以每次都保持upvoting它保存我的屁股! – fatfrog

+2

'sudo的创业板原始--all'不会重建你的宝石,这可能是足够的为好。 –

0

gem update --system应该可以解决你。这将安装最新版本的RubyGems。

+0

嗯哦,它看起来像我一定是坏的宝石......同样的事情发生在我运行gem更新--system – Dave

0

我有同样问题的XCode 4.3。试试这个:

开放的XCode>首选项>下载>安装命令行工具

最后,在终端中运行:

rvm install 1.9.3 --with-gcc=clang 
0

我用jQuery护栏2.0相同的错误。 3:

Invalid gemspec in [C:/Ruby187/lib/ruby/gems/1.8/specifications/jquery-rails-2.0.3.gemspec]: invalid date format in specification: "2012-08-16 00:00:00.000000000Z" 

为了解决这个问题,我编辑了文件C:/ Ruby187/lib/ruby​​/gems /1.8/specifications/jquery-rails-2.0.3.gemspec和更改包含行:

s.date = %q{2012-08-16 00:00:00.000000000Z} 

s.date = %q{2012-08-16} 

然后重新工作。