Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3/Cucumber problem: "...already activated builder 3.0.0, but your Gemfile requires builder 2.1.2"

I've been using cucumber without trouble for with Rails 3 for a while, but after a whole bunch of tinkering today (including gem cleanup), I get the following error whenever I run "cucumber features"

You have already activated builder 3.0.0, but your Gemfile requires builder 2.1.2. Consider using bundle exec. (Gem::LoadError)

Tried it in multiple rails projects on my machine - all are effected. Not quite sure how to tackle this one - tried installing 2.1.2 & specifying it in the gemfile, but no joy.

"bundle exec cucumber features" does work, but it doesn't seem to play nicely with autotest.

Any suggestions regarding what I've done (and better still how to fix it) much appreciated.

like image 651
PlankTon Avatar asked Dec 19 '10 18:12

PlankTon


2 Answers

It looks like after your gem cleanup, builder has been removed and then installed latest version (3.0.0). But rails3 and some of other gems requires ~> 2.1.2, which means that builder version should be >= 2.1.2 and < 3.0.0. So you need to remove 3.0.0 from your system gems:

gem uninstall builder

Use sudo if needed.

Then in your project:

bundle install

NOTE: If you had put manually builder into your Gemfile, make sure that you put ~> 2.1.2. Otherwise bundler will try to install latest stable version (3.0.0), which is not compatible with current version of rails and other popular gems:

gem "builder", "~> 2.1.2"

I would recommend you to store gems in separate locations for each project:

bundle install --path .gems

In this case you can do everything you want with your system gems and it will reduce risk to get in situation like you do now.

like image 105
Vasily Reys Avatar answered Oct 19 '22 17:10

Vasily Reys


Why not use the simpler way?

bundle exec cucumber features

I had the same problem with builder and some other gems. Tried using the "gem unistall" way but then I got an error saying that I need the newer gem. So I was in a deadlock.

With the above command it worked ...

like image 45
MobiLutz Avatar answered Oct 19 '22 19:10

MobiLutz