如何修复Rails安装错误?

时间:2022-10-16 09:56:11

I just installed everything needed for Ruby on Rails on my Ubuntu system. But, when I use the rails command, it outputs these errors:

我在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

How do I fix this?

我怎么修复这个?

1 个解决方案

#1


3  

I would advice to install Ruby + Ruby Gems using a version manager, such as RVM, instead of the distro Ruby : http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

我建议使用一个版本管理器来安装Ruby + Ruby Gems,比如RVM,而不是发行版的Ruby: http://ryanbigg.com/2010/12/ubuntu-rub-rvm - railand -you/。

#1


3  

I would advice to install Ruby + Ruby Gems using a version manager, such as RVM, instead of the distro Ruby : http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

我建议使用一个版本管理器来安装Ruby + Ruby Gems,比如RVM,而不是发行版的Ruby: http://ryanbigg.com/2010/12/ubuntu-rub-rvm - railand -you/。