4

i have passenger 3.0.9 on debian with gem rack 1.3.2 and 1.2.1.

With a rails 3.0 application with passenger e bundler i have this error:

You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3. Consider using bundle exec.

With rails 3.1 is all ok. I can't make start application with rails 3.0 but only with 3.1.

Passnnger load first rack 1.3.2 and don't load rack 1.2.3 on gems of bundler

user537183
  • 81
  • 1
  • 3
  • You can go into your Gemfile.lock file of the application which is being problematic and manually change the version there. – Jasdeep Singh Sep 06 '11 at 16:53
  • I wouldn't manually edit the Gemfile.lock file. It's generated by bundle install based on your Gemfile. – jaydel Sep 06 '11 at 17:00

4 Answers4

3

Short answer:

you need to run

bundle update rack

This will update your rack version in Gemfile.lock

Longer answer:

This error usually happens when your activated rack/rake version is different from your rails app's rack/rake version. When you run 'bundle install', some critical gems won't get update due to dependency.

That's why you need to run 'bundle update' (for all gems), or 'bundle update a_specific_gem' to update a certain gem like rack/rake in you Gemfile.lock.

imonyse
  • 151
  • 2
  • 3
1

What worked for me is this:

  1. Clear your Gemfile.lock
  2. Run bundle install

Problem fixed.

innonate
  • 159
  • 5
0

I had this exact issue on Dreamhosters.com with a recent client. I believe what I did was update my Gemfile to specify the version that is already "activated" and then rebuild the Gemfile.lock.

In my case the problem the issue was that rails was finding the system gems before my local gems and couldn't handle the conflict gracefully. It was on 3.0.3 and I didn't have the same issue on my development box where I use rvm and don't have a system ruby/rails installed at all.

I don't know that this will solve your issues but it might at least give you a starting point for further research. I found a lot of links for this by googling the error message.

jaydel
  • 14,389
  • 14
  • 62
  • 98
  • i we try with gem 'rake', '~> 0.8.7' gem 'rack', '~> 1.3.2' gem 'rails', '3.0.5' and after with bundle exec rack i give this dependency rails (= 3.0.5) depends on rack (~> 1.2.1) rack (1.3.2) i must change the Gemfile.lock by hand? – user537183 Sep 06 '11 at 21:06
  • No, you can actually just delete Gemfile.lock. Put the version requirements right in the Gemfile and when you do bundle install it will generate the Gemfile.lock. – jaydel Sep 07 '11 at 11:06
0

The 5 whys response to your problem is:

Phusion Passenger is not using your application Bundled gems, but another set of gems.

This may be because many different reasons, but all of them related to your particular system (OS, apache/nginx, ruby, environment variables, ...).

  • Make sure your Gemfile is correct (especially the 'source' lines)
  • know which user is running your Phusion Passenger (usually is the same as your web server)
  • Force a bundle path for that user

    BUNDLE_PATH: /home/xxxxxxx/.bundler to RAILS_ROOT/.bundle/config

  • or even better use bundle deployment option to install gems in vendor/bundle

    bundle install --deployment

David
  • 4,080
  • 1
  • 26
  • 34