Guard总是让我讨厌这个问题:

.../gems/bundler-1.6.2/lib/bundler/runtime.rb:34:in `block in setup': You have already activated multi_json 1.10.0, but your Gemfile requires multi_json 1.9.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)


我知道我可以执行bundle updategem uninstall或在Gemfile中指定确切的版本。

有没有一种方法可以一劳永逸地修复它,因此警卫启动bundle exec rspecbin/rspec(我正在使用rbenv)?我想我在github上的某个地方看到了一个补丁,但现在找不到。

更新资料

仅作记录,即使使用bundle exec也会发生以下情况:

$ bundle exec guard
17:11:07 - INFO - Guard is using TerminalNotifier to send notifications.
17:11:07 - INFO - Guard is using TerminalTitle to send notifications.
17:11:07 - INFO - Guard::RSpec is running
17:11:07 - INFO - Guard is now watching at '/Sites/site'
[1] guard(main)>
17:11:10 - INFO - Run all
17:11:10 - INFO - Running all specs
WARN: Unresolved specs during Gem::Specification.reset:
      rspec-expectations (~> 2.14.0)
      rspec-mocks (~> 2.14.0)
      listen (~> 2.7)
      formatador (>= 0.2.4)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
WARN: Unresolved specs during Gem::Specification.reset:
      debugger-ruby_core_source (~> 1.3.2)
      rb-inotify (>= 0.9)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
.../.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:34:in `block in setup': You have already activated formatador 0.2.5, but your Gemfile requires formatador 0.2.4. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
...

最佳答案

所以在潜伏了一段时间之后,我对Guardfile做了一些修改:

之前:

guard :rspec do


后:

guard :rspec, cmd: 'bundle exec rspec' do


那就彻底解决了。

关于ruby-on-rails - Bundler + Guard + Rspec + Rbenv =“您已经激活了……”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23606594/

10-12 07:29
查看更多