Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force rack to work around the usual "You have already activated rack..." bug?

Tags:

This is a common question, but none of the answers seem to solve the issue. I get the usual: You have already activated rack 1.4.1, but your Gemfile requires rack 1.3.6. Using bundle exec may solve this.

Clearing the Gemlock file did nothing and running bundle install again did nothing...running bundle install --binstubs did not solve the issue as "run ./bin/{rake|rails|etc} from your app root" just caused more errors. Is there a way to get rack around this apparently common problem?

like image 583
user1149547 Avatar asked Feb 11 '12 16:02

user1149547


1 Answers

The problem is this:

  • You have (at least) two versions of Rack installed.

  • Your Gemfile calls for one version (1.3.6). Your current environment is providing another version (1.4.1).

  • By the time your application executes, the current environment has already loaded 1.4.1.

  • Bundler knows you need to load 1.3.6, but it can't load it. You may not load more than one version of the same gem, so the 1.4.1 version wins since it was loaded first.

  • Bundler complains to you.

Uninstall the problematic gems (e.g. gem uninstall rack -v 1.3.6). Even better, use RVM and gemsets to isolate your gems better and you won't encounter this issue.

like image 126
John Feminella Avatar answered Oct 12 '22 20:10

John Feminella