我使用Rails。 3.2.16,与Rspec。
最近,当我运行rails console
时,出现以下错误:
.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/minitest/unit.rb:28:in `const_missing': uninitialized constant MiniTest::Test (NameError)
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:8:in `<module:Unit>'
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:4:in `<module:Test>'
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:3:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/activesupport-3.2.16/lib/active_support/test_case.rb:1:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/console/app.rb:2:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/application.rb:312:in `initialize_console'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/application.rb:152:in `load_console'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands/console.rb:27:in `start'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands/console.rb:8:in `start'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
当我运行rails server
时,没有任何问题。
因为我使用Rspec,所以我的Gemfile中没有minitest。但是,当我运行gem list
时,我可以看到:
minitest (5.3.3, 5.3.2, 4.7.5, 4.3.2)
而且我不确定为什么会突然发生这种情况。
@ user3364461可能存在相关问题:
使用RVM和上一个Bundler(1.6.2)ruby 2.1.1和rails 4.1。发生 当我更新了一些宝石(Axlsx-rails,minitest,arel)时如果我强行 minitest 5.3.2,与arel相同的错误:
在任何源代码中找不到minitest-5.3.3运行bundle install 安装缺少的宝石。