Phusion Passenger Error: You have activated rack 1

2019-01-31 08:40发布

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

enter image description here

9条回答
Evening l夕情丶
2楼-- · 2019-01-31 09:10

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:

gem 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.

查看更多
Juvenile、少年°
3楼-- · 2019-01-31 09:13

try to restart your server after edit in your Gemfile and put this: gem 'rack', '1.2.1'

查看更多
在下西门庆
4楼-- · 2019-01-31 09:15

I solved this way on Dreamhost:

Remove from Gemfile any line: gem 'rack', ....

rm Gemfile.lock
rm -rf .bundle
rm -rf  vendor/bundle

install / use the gems locally and regenerates the file 'Gemfile.lock' with:

bundle install

install gems in vendor/bundle

bundle install --deployment

restart:

touch tmp/restart.txt
查看更多
登录 后发表回答