我按照说明如何在 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
为什么乘客还在寻找旧红宝石而没有看到新装置?还是轨道问题?有没有办法让它使用正确的?我在某个地方错过了什么吗?
任何帮助,将不胜感激。
帕维尔。