apache2:您的Ruby版本是2.1.6,但您的Gemfile指定为2.3.4

时间:2017-07-04 02:27:36

标签: ruby-on-rails ruby apache

我正在尝试在 Chrome 上呈现我的 Rails应用。 但是,我收到Passenger的错误页面:

We're sorry, but something went wrong.
The issue has been logged for investigation. Please try again later.

Technical details for the administrator of this website
This website is powered by Passenger®, a rock-solid, feature-rich web application server that integrates with Apache and Nginx built by Phusion®.

apache错误日志表示我遇到以下错误:

Your Ruby version is 2.1.6, but your Gemfile specified 2.3.4

我做了以下但是没有帮助:

$ruby -v
ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin16]

$rbenv version
2.3.4 (set by /Users/.../.rbenv/version)

$gem update bundler 
Updating installed gems
Nothing to update

$ brew upgrade ruby-build
Error: ruby-build 20170523 already installed

$ bundle install
...Bundle complete!...

有谁知道如何修复它? 提前谢谢!

1 个答案:

答案 0 :(得分:0)

我们需要告诉Passenger它在哪里.Passenger使用随系统Ruby安装的gem而不是新版本。

编辑/ etc / apache2 / mods-available / passenger.conf`:

<IfModule mod_passenger.c>
  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  PassengerDefaultRuby /home/$YOUR_HOME_DIRECTORY/.rbenv/shims/ruby
</IfModule>