为什么" gem install rails"导致错误"

时间:2014-05-17 18:05:24

标签: ruby-on-rails ruby

我只是试图将我的ruby在rails环境中从1.9.3降级到1.8.7

我已经成功更新了Ruby!但是我现在正在尝试更新" rails"。

当我跑步时,我收到以下错误。我该如何解决这个问题?

$ gem install rails 
ERROR:  Error installing rails:
activesupport requires Ruby version >= 1.9.3.

感谢

如果我运行$ gem install rails --debug,我会得到以下内容:

Exception `Gem::LoadError' at c:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:298 - Could n
Exception `LoadError' at c:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:55 -
Exception `LoadError' at c:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:141 -
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - The system can
Exception `Win32::Registry::Error' at c:/Ruby187/lib/ruby/1.8/win32/registry.rb:397 - No more data i
Exception `Errno::EEXIST' at c:/Ruby187/lib/ruby/1.8/fileutils.rb:243 - File exists - c:/Users/Adam/
Exception `Resolv::DNS::Config::NXDomain' at c:/Ruby187/lib/ruby/1.8/resolv.rb:495 - _rubygems._tcp.
Exception `Resolv::DNS::Config::NXDomain' at c:/Ruby187/lib/ruby/1.8/resolv.rb:495 - _rubygems._tcp.
Exception `Resolv::ResolvError' at c:/Ruby187/lib/ruby/1.8/resolv.rb:459 - DNS result has no informa
Exception `Errno::EEXIST' at c:/Ruby187/lib/ruby/1.8/fileutils.rb:243 - File exists - c:/Ruby187/lib
Exception `Gem::InstallError' at c:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:543 - activ
ERROR:  Error installing rails:
        activesupport requires Ruby version >= 1.9.3.

2 个答案:

答案 0 :(得分:1)

Ruby 1.8.7 is no longer supported.,非常不鼓励使用1.8.7,因为您不会收到任何安全更新。

因此,最新稳定版本的rails - v4.1需要ruby 1.9.3或更高版本。如果由于某种原因,你仍然想要使用旧的,过时的&不受支持的ruby版本。你必须使用旧版本的rails:

$ gem install rails -v 3.2

但是我会鼓励你升级到最新的ruby 2.1.2,因为它的速度要快得多。更好。

答案 1 :(得分:0)

“activesupport需要Ruby版本> = 1.9.3。”

但你刚才说你把你的红宝石版本降级为1.8.7。 当然,您需要将ruby更新回原始版本的1.9.3以更新rails。

还列在http://ubyonrails.org/download上: -

  

“我们建议使用Ruby 2.1.0与Rails一起使用。我们停止了支持   Rails 3.2之后的Ruby 1.8.x.在Rails之前,将支持Ruby 1.9.2+   5。“