【发布时间】:2014-08-05 12:23:31
【问题描述】:
我是使用 heroku 和 ruby 的新手(这肯定可以解释为什么我没有抓住重点),这是我的问题:
我之前在 heroku 上部署了一个基本的 sinatra 应用程序,没有任何问题,但我最近用 Sequel ORM 的数据库支持更新了它。虽然在我的 vagrant vhost 上一切正常,但在 heroku 上部署后,服务器因加载错误异常而崩溃:
Jun 15 07:49:50 test-app heroku/web.1: State changed from crashed to starting
Jun 15 07:50:01 test-app heroku/web.1: Starting process with command `bundle exec thin start -p 23255`
Jun 15 07:50:09 test-app app/web.1: /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require': cannot load such file -- activemodel (LoadError)
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
Jun 15 07:50:09 test-app app/web.1: from config.ru:7:in `block in <main>'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
Jun 15 07:50:09 test-app app/web.1: from config.ru:1:in `new'
Jun 15 07:50:09 test-app app/web.1: from config.ru:1:in `<main>'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/rack/adapter/loader.rb:33:in `eval'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/rack/adapter/loader.rb:33:in `load'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/thin/controllers/controller.rb:182:in `load_rackup_config'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/thin/controllers/controller.rb:72:in `start'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/thin/runner.rb:199:in `run_command'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/thin/runner.rb:155:in `run!'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/bin/thin:6:in `<top (required)>'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `load'
Jun 15 07:50:09 test-app app/web.1: from /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `<main>'
Jun 15 07:50:10 test-app heroku/web.1: Process exited with status 1
Jun 15 07:50:10 test-app heroku/web.1: State changed from starting to crashed
我很确定在 heroku 环境中存在与 $LOAD_PATH 相关的特定内容,但我找不到问题所在,因为我无法在自己的环境中重现它(即使在生产模式下,从全新安装,使用相同的命令启动服务器)。
我尝试了几个针对此处发现的类似问题的提议,例如以不同方式修改 Procfile 或 config.ru,或者在 Gemfile 中显式添加 activemodel Gem,但到目前为止没有任何帮助。
任何帮助将不胜感激!
编辑
好的,伙计们,按照你的建议,我添加gem 'activerecord',而不是'active_record',因为Could not find gem 'active_record (>= 0) ruby' in the gems available on this machine.
Heroku 不再抱怨,应用程序启动...
但我需要了解:
- 为什么需要我不需要也不需要的 gem(我使用的是续集,据我所知,它根本不使用活动记录)
- 为什么我在 heroku 上没有任何问题?
谢谢
【问题讨论】:
-
您是否需要必需的“active_record”? [stackoverflow.com/questions/8981576/… |相关问题]
标签: ruby heroku sinatra sequel