1

我在 Amazon EC2 上托管了一个 Ruby on Rails 应用程序。我正在使用 Java SSH 客户端连接实例。当我进入我在 Amazon 上的工作目录并尝试输入时,rails c它显示错误require': cannot load such file -- minitest/unit (LoadError)。我不知道为什么我无法访问 rails 控制台。

/usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- minitest/unit (LoadError)
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/test/unit/assertions.rb:1:in `<top (required)>'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/test/unit/testcase.rb:1:in `<top (required)>'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/test_case.rb:1:in `<top (required)>'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.13/lib/rails/console/app.rb:2:in `<top (required)>'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:304:in `initialize_console'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:152:in `load_console'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:27:in `start'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
    from /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我试图通过安装来解决这个错误,gem install minitest-rails但它抛出了错误

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /usr/share/ruby/1.9/gems/1.9.1 directory.

我尝试在我的 gemfile 中添加两个 gem gem 'turn' , '< 0.8.3'gem 'minitest-rails然后推送到 AWS 但没有得到任何东西。

如何摆脱这个错误。我想访问我的 rails 控制台。请帮忙。提前致谢。

4

2 回答 2

1

为了克服这个错误,我必须同时执行“gem install minitest”并将“gem 'minitest'”添加到项目 Gemfile。我通过阅读GitHub 上关于 Rails 的这个未解决问题的评论得到了这个解决方案;在解决此问题之前,您可能会在那里找到进一步的解决方案。

于 2014-02-17T06:20:02.453 回答
0

尝试这个

group :test do
  gem 'turn', '< 0.8.3',
  gem 'minitest', '~> 5.0.5'
end

如果我错了,请纠正我,但我猜你正在尝试安装 Cucumber。如果不是,请指定您的 rails 版本和 ruby​​ 版本。

于 2013-06-26T05:57:12.510 回答