试图在Dreamhost上测试VPS上的应用程序

时间:2011-10-11 19:41:01

标签: ruby-on-rails passenger bundler dreamhost

我正在拔出我的头发试图在DH的VPS上启动一个简单的应用程序。

第1步:创建测试应用

$ rails new test app

第2步:修改了config / environment.rb:

require File.expand_path('../application', __FILE__)

if ENV['RAILS_ENV'] == 'production'  # don't bother on dev
  ENV['GEM_PATH'] = '/home/feebzee/.gems' + ':/usr/lib/ruby/gems/1.8'
end

# Initialize the rails application
Testapp::Application.initialize!

应用程序在端口3000上使用webrick正常运行。但是如果我让乘客加载它,我就会到达Rails Welcome Aboard页面,即使点击链接显示应用程序环境也会返回错误。

我已附上以下错误消息,以方便您的观看。提前谢谢,去RoR! : - )

Error message:
no such file to load -- bundler/setup

Exception class:
LoadError

Application root:
/home/feebzee/testapp



# Initialize the rails application
Testapp::Application.initialize!
#   File    Line    Location
0   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `gem_original_require'
1   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `require'
2   /home/feebzee/testapp/config/boot.rb    6   
3   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `gem_original_require'
4   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `require'
5   /home/feebzee/testapp/config/application.rb 1   
6   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `gem_original_require'
7   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `require'
8   /home/feebzee/testapp/config/environment.rb 2   
9   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `gem_original_require'
10  /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `require'
11  config.ru   3   
12  /var/lib/gems/1.8/gems/rack-1.3.4/lib/rack/builder.rb   51  in `instance_eval'
13  /var/lib/gems/1.8/gems/rack-1.3.4/lib/rack/builder.rb   51  in `initialize'
14  config.ru   1   in `new'
15  config.ru   1   

2 个答案:

答案 0 :(得分:0)

您是否为您正在使用的环境安装了bundler gem?

答案 1 :(得分:0)

WEBrick默认情况下以开发模式运行,但乘客默认以生产模式运行。

以下配置:

if ENV['RAILS_ENV'] == 'production'  # don't bother on dev
  ENV['GEM_PATH'] = '/home/feebzee/.gems' + ':/usr/lib/ruby/gems/1.8'
end

...意味着您在运行乘客时尝试加载一个宝石,而不是在使用WEBrick时 - 假设您没有明确指定环境。

尝试运行bundle install