I'm trying to run a Ruby on Rails app on a Dreamhost shared server. All is well so far except one weird bug I have not been able to unravel.
Sometimes when I visit the web app, I get presented with a Phusion Passenger error saying,
You have already activated rack 1.2.1, but your Gemfile requires rack 1.2.2. Consider using bundle exec.
When I just refresh the page it seems to work, though - no more Phusion Passenger error message.
Following other stack overflow threads and a similar Dreamhost wiki, I added the following to the top of the config/environment.rb
file:
if ENV['RAILS_ENV'] == 'production' # don't bother on dev
ENV['GEM_PATH'] = '/home/myusername/.gems' + ':/usr/lib/ruby/gems/1.8'
end
I just ran into this problem on Dreamhost. The problem is that the Dreamhost server has rack 1.2.1 installed and your Gemfile is loading 1.2.2. I found that if I just install rack:
Then the latest version of rack (1.2.2 as of right now) will get installed to your home gems folder (~/.gems). When passenger starts up, it will use 1.2.2.
try to restart your server after edit in your Gemfile and put this:
gem 'rack', '1.2.1'
I solved this way on Dreamhost:
Remove from Gemfile any line: gem 'rack', ....
install / use the gems locally and regenerates the file 'Gemfile.lock' with:
install gems in vendor/bundle
restart: