尝试在 Dreamhost 的 VPS 上测试应用程序
我正在费尽心思地尝试在 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
I'm pulling out my hair trying to fire up a simple app on a VPS at DH.
Step 1: Created the test app
$ rails new test app
Step 2: Modified 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!
App runs fine using webrick at port 3000. But if I let passenger load it, I get as far as the Rails Welcome Aboard page and it returns an error even at by clicking on the link to display the app environment.
I've attached the error messages below for your viewing pleasure. Thanks in advance and go 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否为您正在使用的环境安装了捆绑程序 gem?
Do you have the bundler gem installed for the environment you're using?
WEBrick 默认在开发模式下运行,但乘客默认在生产模式下运行。
以下配置:
...意味着您在运行乘客时尝试加载 gem,而在使用 WEBrick 时则不会加载 - 假设您自己没有明确指定环境。
尝试运行
bundle install
。WEBrick runs in development mode by default, but passenger runs in production mode by default.
The following config:
...means you're trying to load a gem when running passenger that you're not when using WEBrick - assuming you're not specifying environment explicitly yourself.
Try running
bundle install
.