运行rails控制台突然停止工作

时间:2014-11-19 20:21:24

标签: ruby-on-rails ruby ruby-on-rails-4 rubygems

突然之间,Rails'控制台停止了我的一个项目。我一直收到以下错误:

rails c
Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
Could not find activesupport-4.1.4 in any of the sources
Run `bundle install` to install missing gems.

所以我更新了Rubygems,使用以下两行(来自rubygems.com)

$ gem install rubygems-update  # again, might need to be admin/root
$ update_rubygems  

并获得以下输出:

Successfully installed rubygems-update-2.4.4
Parsing documentation for rubygems-update-2.4.4
Done installing documentation for rubygems-update after 0 seconds
1 gem installed

...

RubyGems 2.4.4 installed
Parsing documentation for rubygems-2.4.4
Installing ri documentation for rubygems-2.4.4
=== 2.4.4 / 2014-11-12

Aaaaaand,然后我再次运行rails console,并再次收到相同的错误消息。

思想?

3 个答案:

答案 0 :(得分:1)

只有在使用rvm时才会出现问题,否则只需忽略它。

导航到根路径(rails应用程序所在的位置)。

在命令行中键入;

rvm list

你会得到类似的东西:

rvm rubies

   jruby-1.7.11 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
=* ruby-2.0.0-p451 [ x86_64 ]
   ruby-2.1.0 [ x86_64 ]
   ruby-2.1.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

如果您的默认值不是当前的,那么您最有可能更改它。 尝试将其更改并运行:

你可以改变它:

rvm use ruby-2.0.0-p451

当你获得正确的版本时,你可以使它永久化。

像这样:

rvm --default use ruby-2.0.0-p451

bundle install 

试。

答案 1 :(得分:0)

只是在黑暗中拍摄,但也许可以尝试:

gem install activesupport -v 4.1.4

然后尝试再次运行rails c。

答案 2 :(得分:0)

该消息还说运行gem pristine --all,它将从缓存重新安装所有宝石并重新编译宝石中的所有本机驱动程序。

更新Rubygems代码不会这样做,因此您必须显式运行该命令。

相关问题