Phusion 乘客错误:您已激活机架 1.2.1,但您的 Gemfile 需要机架 1.2.2

人气:619 发布:2022-10-16 标签: dreamhost ruby-on-rails ruby rubygems passenger

问题描述

我正在尝试在 Dreamhost 共享服务器上运行 Ruby on Rails 应用程序.到目前为止一切都很好,除了一个我无法解开的奇怪错误.

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.

有时当我访问网络应用程序时,我会收到 Phusion Passenger 错误提示,

Sometimes when I visit the web app, I get presented with a Phusion Passenger error saying,

您已经激活了 rack 1.2.1,但是您的 Gemfile 需要 rack 1.2.2.考虑使用 bundle exec.

You have already activated rack 1.2.1, but your Gemfile requires rack 1.2.2. Consider using bundle exec.

当我只是刷新页面时,它似乎可以工作,但是 - 没有更多 Phusion Passenger 错误消息.

When I just refresh the page it seems to work, though - no more Phusion Passenger error message.

关注其他堆栈溢出线程和类似 Dreamhost wiki,我在 config/environment.rb 文件的顶部添加了以下内容:

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

推荐答案

在你的 Gemfile 中编辑后尝试重新启动你的服务器并输入:gem 'rack', '1.2.1'

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

675