1

每当我运行以下代码时,我都会在终端上收到这些错误。

rake test  or bundle exec rake test

/usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- guard (LoadError)
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/guard-minitest-2.4.4/lib/minitest/guard_minitest_plugin.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:91:in `block in load_plugins'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:85:in `each'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:85:in `load_plugins'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:114:in `run'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:56:in `block in autorun'
4

1 回答 1

1

看起来guard没有安装/包含在 Gemfile 中。如果 Gemfile 不存在,请将其包含在 Gemfile 中。并运行bundle install

请参阅http://railscasts.com/episodes/264-guard了解如何使用警卫。https://github.com/guard/guard也是一个很好的资源。

于 2015-03-24T00:28:31.517 回答