Rails 4:守卫不是捆绑包的一部分。将其添加到 Gem 文件。 (Gem::加载错误)

Rails 4: guard is not part of the bundle. Add it to Gemfile. (Gem::LoadError)

我正在尝试复制 Michael Hartl 的 Rails 教程中的 Advanced testing setup,该教程使用 guard-minitest.

这是我的 Gemfile:

source 'https://rubygems.org'

gem 'rails',        '4.2.2'
gem 'sass-rails',   '~> 5.0'
gem 'uglifier',     '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder',     '~> 2.0'
gem 'sdoc',         '~> 0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3',     '1.3.10'
  gem 'byebug',      '6.0.2'
  gem 'web-console', '2.2.1'
  gem 'spring',      '1.3.6'
end

group :test do
  gem 'minitest-reporters', '1.0.20'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard-minitest',     '2.4.4'
end

group :production do
  gem 'pg',             '0.18.2'
  gem 'rails_12factor', '0.0.3'
end

这是我在 运行 bundle install --without production:

时得到的结果
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.....
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.2
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.2
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.2
Using globalid 0.3.6
Using activejob 4.2.2
Using mime-types 2.6.1
Using mail 2.6.3
Using actionmailer 4.2.2
Using activemodel 4.2.2
Using arel 6.0.3
Using activerecord 4.2.2
Using ansi 1.5.0
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using bundler 1.10.4
Using byebug 6.0.2
Using coffee-script-source 1.9.1.1
Using execjs 2.6.0
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.2
Using coffee-rails 4.1.0
Using guard-compat 1.2.1
Using guard-minitest 2.4.4
Using multi_json 1.11.2
Using jbuilder 2.3.1
Using jquery-rails 4.0.4
Using sprockets 3.3.3
Using sprockets-rails 2.3.2
Using rails 4.2.2
Using mini_backtrace 0.1.3
Using ruby-progressbar 1.7.5
Using minitest-reporters 1.0.20
Using rdoc 4.2.0
Using sass 3.4.18
Using tilt 1.4.1
Using sass-rails 5.0.3
Using sdoc 0.4.1
Using spring 1.3.6
Using sqlite3 1.3.10
Using turbolinks 2.5.3
Using uglifier 2.7.1
Using web-console 2.2.1
Bundle updated!
Gems in the group production were not installed.

看来我确实安装了 guard-minitest 2.4.4

但是,当我 运行 bundle exec guard init 时,出现以下错误:

/Users/XXX/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.10.4/lib/bundler/rubygems_integration.rb:292:in `block in replace_gem': guard is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
    from /Users/XXX/.rvm/gems/ruby-2.2.1/bin/guard:22:in `<main>'
    from /Users/XXX/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/XXX/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

知道我做错了什么吗?

guard-minitest README 的安装部分所述,gem 的更新版本也需要 guard

我刚刚更新了我的 Gemfile 如下:

[...]
group :test do
  gem 'minitest-reporters', '1.0.20'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard'
  gem 'guard-minitest',     '2.4.4'
end
[...]

现在一切正常。