Bluehost上的Passenger看不到正确的Ruby版本

时间:2013-05-29 16:43:58

标签: ruby-on-rails ruby passenger ruby-on-rails-4 bluehost

我遵循了如何在Bluehost上安装最新ruby版本的指令,并设法使用Rails-4.0.0-rc1获取Ruby-2.0.0-p195。我完全有能力运行irb并下载gem文件。

bash [~/rails/sample/config]# ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
bash [~/rails/sample/config]# rails -v
Rails 4.0.0.rc1
bash [~/rails/sample/config]# which ruby
/home6/username/ruby/bin/ruby
bash [~/rails/sample/config]# which rails
/home6/username/ruby/gems/bin/rails

我能够创建一个空应用程序,以测试它是否运行。我的.htaccess文件就像这样:

bash [~/rails/sample/config]# more ~/www/sample/.htaccess 
Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
#Set this to whatever environment you'll be running in
RailsEnv production
RackBaseURI /
PassengerAppRoot /home6/username/rails/sample
SetEnv GEM_HOME /home6/username/ruby/gems
bash [~/rails/sample/config]# 

我的.bashrc文件如下所示:

bash [~]# more ~/.bashrc 
# .bashrc

export GEM_HOME=$HOME/ruby/gems
export GEM_PATH=$GEM_HOME:/usr/lib64/ruby/gem/1.8
export GEM_CACHE=$GEM_HOME/cache
export PATH=$HOME/ruby/gems/bin:$PATH
export PATH=$HOME/ruby/bin:$PATH
export PATH=$HOME/node/bin:$PATH

当我访问我的页面(www.somedomain.com/sample)时,我发现乘客有以下错误:

Ruby (Rack) application could not be started

The application has exited during startup (i.e. during the evaluation of config/environment.rb). 
The error message can be found below. To solve this problem, please follow any instructions in the
error message.

Error message: Rails 4 prefers to run on Ruby 2.0. You're running ruby 1.8.7 (2012-02-08 MBARI 8/0x6770  
on patchlevel 358) [x86_64-linux], MBARI 0x6770, uby Enterprise Edition 2012.02 Please upgrade to Ruby 
1.9.3 or newer to continue.

Application root: /home6/username/rails/sample

Backtrace:    
0   /home6/username/ruby/gems/gems/railties-4.0.0.rc1/lib/rails/ruby_version_check.rb   Line 3  in `abort'
1   /home6/username/ruby/gems/gems/railties-4.0.0.rc1/lib/rails/ruby_version_check.rb   Line 3  
2   /home6/username/ruby/gems/gems/railties-4.0.0.rc1/lib/rails.rb  Line 1  in `require'
3   /home6/username/ruby/gems/gems/railties-4.0.0.rc1/lib/rails.rb  Line 1  
4   /home6/username/ruby/gems/gems/railties-4.0.0.rc1/lib/rails/all.rb  Line 1  in `require'
5   /home6/username/ruby/gems/gems/railties-4.0.0.rc1/lib/rails/all.rb  Line 1  
6   /home6/username/rails/sample/config/application.rb  Line 3  in `require'
7   /home6/username/rails/sample/config/application.rb  Line 3  
8   /home6/username/rails/sample/config/environment.rb  Line 2  in `require'
9   /home6/username/rails/sample/config/environment.rb  Line 2  
10  config.ru   Line 3  in `require'
11  config.ru   Line 3  
12  /home6/username/ruby/gems/gems/rack-1.5.2/lib/rack/builder.rb   Line 55 in `instance_eval'
13  /home6/username/ruby/gems/gems/rack-1.5.2/lib/rack/builder.rb   Line 55 in `initialize'
14  config.ru   Line 1  in `new'
15  config.ru   Line 1  

为什么乘客仍在寻找旧的红宝石并且没有看到新装置?或者是轨道问题?有没有办法让它使用正确的?我在某处错过了什么吗?

任何帮助都将不胜感激。

保尔。

1 个答案:

答案 0 :(得分:0)

这是因为服务器没有运行Phusion Passenger 4.只有Phusion Passenger 4.0.0支持多个Ruby版本,支持从bashrc读取环境变量。服务器当前正在运行3.x版本。