如何修复Rails安装错误?

时间:2012-01-22 16:51:12

标签: ruby-on-rails ruby gem

我刚刚在我的Ubuntu系统上安装了Ruby on Rails所需的一切。但是,当我使用rails命令时,它会输出以下错误:

root@laptop3:/var/lib/gems/1.8/specifications# rails -v
Invalid gemspec in [/var/lib/gems/1.8/specifications/activemodel-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb632551c> 3.2.0"]
Invalid gemspec in [/var/lib/gems/1.8/specifications/activerecord-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb61ac1b8> 3.2.0"]
Invalid gemspec in [/var/lib/gems/1.8/specifications/activeresource-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb62d399c> 3.2.0"]
Invalid gemspec in [/var/lib/gems/1.8/specifications/actionpack-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb6249abc> 3.2.0"]
Invalid gemspec in [/var/lib/gems/1.8/specifications/railties-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb62cda38> 3.2.0"]
Invalid gemspec in [/var/lib/gems/1.8/specifications/actionmailer-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb62d97e8> 3.2.0"]
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/rails-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb616b690> 3.2.0"]
/usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:926:in `report_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError)
  from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:244:in `activate_dep'
  from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:236:in `activate'
  from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1307:in `gem'
  from /usr/local/bin/rails:18

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:3)

我建议使用版本管理器(如RVM)而不是发行版Ruby来安装Ruby + Ruby Gems:http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/