2011-10-09 46 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} 

然後重新工作。