Bundler problem: "You have already activated launchy 0.3.7"

Mar 11th, 2011

I just wanted to post this in case anyone else is getting a weird error saying
“You have already activated launchy 0.3.7. Consider using bundle exec.” – even
though you are already using bundle exec. Here is the full error
message:

This can happen if your gem or app is requiring launchy and you have
version 0.4.0 installed on your system. The open_gem gem (which
you are perhaps not even using, but it’s being auto-loaded anyway by
rubygems) requires launchy ~> 0.3.5 (meaning, 0.3.5 or
0.3.7), but because it’s loaded outside of Bundler, when Bundler runs and
calculates your dependencies, it does not take this into account and simply
records version 0.4.0 in your Gemfile.lock. And then when you try to load your
app or gem, it balks because 0.3.5 or 0.3.7 has already been loaded by
open_gems.

The “obvious” solution is to fix your app to require launchy ~> 0.3.5
as well so it won’t try to load version 0.4.0, but once open_gem gets
fixed to work
with version 0.4.0, you will just have this problem the other way around, with
open_gem loading version 0.4.0, and your app trying to load 0.3.7.

Uninstalling launchy 0.4.0 from your system won’t work either, because Bundler
will simply reinstall it when you rerun bundle install (even after
you’ve deleted your Gemfile.lock).

For me, the only way to solve this problem was to uninstall open_gem:

1

sudo gem uninstall open_gem

It will also tell you about breaking dependencies – in my case, I’ve had to
uninstall guard beforehand.

Now open_gem does not get loaded anymore, and requiring launchy 0.4.0
works fine again.