问题
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
回答1:
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.
回答2:
What worked for me is this:
- Clear your
Gemfile.lock
- Run
bundle install
Problem fixed.
回答3:
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.
回答4:
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
来源:https://stackoverflow.com/questions/7323357/problem-with-rack-1-3-2-you-have-already-activated-rack-1-3-2-but-your-gemfile