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

发布于 2024-12-09 04:57:12 字数 1821 浏览 0 评论 0原文

我正在费尽心思地尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

○闲身 2024-12-16 04:57:12

您是否为您正在使用的环境安装了捆绑程序 gem?

Do you have the bundler gem installed for the environment you're using?

冧九 2024-12-16 04:57:12

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

以下配置:

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

...意味着您在运行乘客时尝试加载 gem,而在使用 WEBrick 时则不会加载 - 假设您自己没有明确指定环境。

尝试运行bundle install

WEBrick runs in development mode by default, but passenger runs in production mode by default.

The following config:

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

...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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文