215

When launching Guard, I'm getting this output:

$ guard
WARN: Unresolved specs during Gem::Specification.reset:
      lumberjack (>= 1.0.2)
      ffi (>= 0.5.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.

What does this mean, and how do I fix it?

Contents of Guardfile:

guard 'livereload' do
    watch(%r{.+\.(css|js|html)$})
end
guard 'sass', :input => 'css', :style => :compressed, :extension => '.min.css'
mabu
  • 286
  • 8
  • 26
reneruiz
  • 2,436
  • 2
  • 20
  • 18
  • 2
    I'm getting this too and not even running guard. – Douglas G. Allen Aug 10 '15 at 16:13
  • [This post](https://github.com/rubygems/rubygems/issues/1267#issuecomment-281694950) is very helpful if you're using RVM. – GDP2 Jun 20 '18 at 06:36
  • My two cents: Ran across a similar error when running RSpec; Had the gems on my machine, but was told to run `gem cleanup `; instead, I ran `bundle exec rspec ` and it worked – J.R. Bob Dobbs Oct 13 '22 at 22:50

11 Answers11

292

I was seeing this issue by just running RSpec on its own. From what I understand, this means that you have more than one version of the listed gems installed on your system, and RSpec is unsure which one to use. After uninstalling older version of the gems, the warnings went away.

You can try:

gem cleanup lumberjack

Or:

gem list lumberjack

gem uninstall lumberjack

If you're using Bundler, you can try bundle exec guard (or in my case bundle exec rspec).

EricC
  • 1,355
  • 1
  • 20
  • 33
jallen7usa
  • 3,128
  • 1
  • 17
  • 8
  • 3
    You put me on the right track. I was getting errors when running 'gem cleanup' so I found this: http://stackoverflow.com/questions/4007074/uninstalling-rails-and-gems-getting-error-cannot-uninstall-check-gem-list-d/4060347#4060347 Turns out it had to do with RVM. When I ran 'rvm gemset use global' and ran guard, the errors went away. – reneruiz Aug 08 '13 at 18:54
  • I was using rbenv and gem cleanup [gemname] worked for me perfectly. Thanks. – Matt Nov 11 '13 at 14:34
  • 3
    I had a similar issue, running bundle update solved it – mike Jan 07 '14 at 16:50
  • 4
    After `rvm gemset use global` (and `gem cleanup `) make sure to switch back to your default gemset with `rvm gemset use default` – AlexChaffee Feb 21 '14 at 13:22
  • I needed to use `gem uninstall ` but thanks and upvote for pointing me in the right direction! – reducing activity Apr 07 '17 at 11:54
184

Using the following command solved it for me:

bundle clean --force

See guard-and-unresolved-specs for more info

Pieter van der Merwe
  • 2,235
  • 1
  • 16
  • 13
  • 1
    I've tried a ton of things, including reinstalling RVM and Ruby, until I bumped into this solution and this did it for me. – George Jul 21 '15 at 11:54
  • Man, i wasted few hours trying to figure out why Textmate 2 was glitching out when I was running tests. This cleared it out. – Grocery Dec 10 '16 at 21:01
  • I needed to `su`/`sudo` to do this, since it was trying to write to `/var/lib/gems`. Other than that - works for jekyll. – einpoklum Jun 04 '17 at 14:23
  • I found this while debugging an Issue with the RubyMine debugger: `Unresolved or ambiguous specs during Gem::Specification.reset` for the reline gem. After the force cleanup RubyMine reinstalled the debugger gems, this time seemingly without issues. – Rich Steinmetz Oct 30 '22 at 15:04
27

Use Bundler. Call bundle exec guard, not guard.

Nowaker
  • 12,154
  • 4
  • 56
  • 62
14

FYI:

gem cleanup

worked for me.

$ gem cleanup       

Cleaning up installed gems...
Attempting to uninstall builder-3.2.2
Successfully uninstalled builder-3.2.2
Attempting to uninstall amatch-0.3.0
Successfully uninstalled amatch-0.3.0
Attempting to uninstall tins-1.12.0
Successfully uninstalled tins-1.12.0
Clean Up Complete
Shiva
  • 11,485
  • 2
  • 67
  • 84
12

This worked for me:

bundle clean --force

then

bundle install

to reinstall gems.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Vanessa Ejikeme
  • 159
  • 1
  • 6
6

I use gem list gem-name; gem uninstall gem-name to clean the gem one by one because of the dependency. After that, the error does not show again.

arthur bryant
  • 395
  • 5
  • 6
4

add

'bundle exec'

before your command.

I use ruby 2.4 and got the same problem when deploying jekyll on windows, it fixed.

IBam
  • 10,114
  • 1
  • 24
  • 36
0

Remember, if you want to use guard, you have to add gem guard to Gemfile.

group :developement, :test do
  gem 'guard'
end

Then, run

bundle install

I hope this can help you.

Iulian Onofrei
  • 9,188
  • 10
  • 67
  • 113
rocLv
  • 548
  • 6
  • 15
0

I was getting this message while running Rspec within a Guard plugin gem, using bundle exec rspec. It turned out to be a missing line in the gemspec file:

$:.push File.expand_path("../lib", __FILE__)

This line is normally at the top of the file (in many of the gems I have recently been working in) and I had commented it out to see why.

Robin Daugherty
  • 7,115
  • 4
  • 45
  • 59
0

If anyone has come this far and still hasn't found the answer I leave you with this. gem update --system. I tried all of these other answers to no avail. Hopefully this works for you.

0

Try gem uninstall <gem> and it will remove all younger versions of gem.

You will then be asked

"If you remove this gem, these dependencies will not be met. Continue deleting? [YN]"

Select the answer

"no"

to leave the latest version of gem and all dependencies remain valid.