Question

Guard is always annoying me with this issue:

.../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)

I know I can do bundle update or gem uninstall or specify the exact version in Gemfile.

Is there a way to fix it once and for all so guard launches bundle exec rspec or bin/rspec (I am using rbenv)? I think I saw a patch somewhere on github but I can't find it now.

Update

Just for the record here is what happening even with 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)
...
Was it helpful?

Solution

So after lurking on it for a while I have amended Guardfile a bit:

Before:

guard :rspec do

After:

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

And that solved it once and for all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top