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
This works in Rails 3.0.x & Passenger 3.0.15
create a file:
with content:
Passenger will then load the rack gem specified in your Gemfile.lock
After long periods of inactivity, I've been receiving a similar error for a couple of Sinatra applications on a DreamHost VPS:
Phusion Passenger Error: You have activated rack 1.2.1, but your Gemfile requires rack 1.3.0.
Like how @aren55555 described, if you simply refresh the page, the error goes away. Here is something that I discovered about the server configuration:
My guess as to what was happening is, after Passenger "wakes up", for some reason it's looking first (or perhaps only) to the Gems at the system-level, selecting Rack 1.2.1 as the latest version. My short-term hacky solution was simply to install Rack 1.3.0 there:
gem install rack -v 1.3.0 --install-dir /usr/lib/ruby/gems/1.8
It seems to have worked. Hope this is helpful to anyone else tearing their hair out there.
I have the same issue: "You have already activated rack 1.2.1, but your Gemfile requires rack 1.2.3"
uninstall rack versions > 1.2.1
[wasp]$ gem list |grep rack
rack (1.2.1, 1.1.0, 1.0.1, 1.0.0)
touch tmp/restart.txt
It might be worth checking this out. Someone made a way to get debugger working with Passenger & Rails 3 - http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger
I fought with this problem for hours before eventually giving up on Passenger. Any new version of Rails will use a more recent Rack than Dreamhost's Passenger requires.
However, you don't need Passenger to boot the app. Dreamhost provides some pretty easy (and working) instructions about how to boot the app using FastCGI, and you won't have to corrupt your Gemfile in the process:
http://wiki.dreamhost.com/Rails_3#Using_FastCGI
My had a similar problem with Apache: "You have already activated rack 1.2.3, but your Gemfile requires rack 1.2.2. Consider using bundle exec."
The problem was that Passenger install rack 1.2.3 and my rails APP rack 1.2.2:
Try:
restart the server and solved