【问题标题】:Rails: Heroku Deploying for the First Time FailedRails:Heroku 首次部署失败
【发布时间】:2012-11-06 22:34:58
【问题描述】:

我认为问题在于我使用的是 SQLite3,所以我迁移到 PostgreSQL,但问题仍然存在。该应用程序在本地运行良好。我在打开 heroku 的情况下打开我的应用程序,它给了我以下错误:

Application Error. An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details..

我试图通过查看日志来找到解决方案,但失败了,所以我需要别人的帮助。 这是我的日志,感谢您的帮助!

2012-11-19T00:55:37+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e production -p 3545`
2012-11-19T00:55:39+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your
the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-11-19T00:55:39+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your
the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
2012-11-19T00:55:41+00:00 app[web.1]: /app/config/initializers/formtastic.rb:2:in `<top (required)>': uninitialized constant Formtastic (NameError)
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `each'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `block in <class:Engine>'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/config/environment.rb:5:in `<top (required)>'

2012-11-19T00:55:41+00:00 app[web.1]:   from config.ru:3:in `require'
2012-11-19T00:55:41+00:00 app[web.1]:   from config.ru:3:in `block in <main>'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-11-19T00:55:41+00:00 app[web.1]:   from config.ru:1:in `new'
2012-11-19T00:55:41+00:00 app[web.1]:   from config.ru:1:in `<main>'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/rack/adapter/loader.rb:33:in `eval'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/rack/adapter/loader.rb:33:in `load'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/runner.rb:187:in `run_command'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/runner.rb:152:in `run!'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/bin/thin:6:in `<top (required)>'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'

2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
2012-11-19T00:55:41+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/controllers/controller.rb:71:in `start'
2012-11-19T00:55:42+00:00 heroku[web.1]: Process exited with status 1
2012-11-19T00:56:34+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fast-savannah-6843.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-19T00:56:34+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fast-savannah-6843.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-19T00:57:44+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fast-savannah-6843.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-19T00:57:44+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fast-savannah-6843.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=

【问题讨论】:

  • 您的 gemfile 中包含了 Formtastic,对吧?
  • 是的! group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'bootstrap-sass' gem 'formtastic-bootstrap'
  • 你在运行 rails server 之前尝试过安装 bundle 吗?
  • 是的,并且 bundle install 也给了我错误。我认为 heroku.bat 有问题,我需要将 PATH 设置为 C:\railsinstaller\Ruby1.9.3 .. 你认为这是正确的吗?
  • 好的,问题是“RailsInstaller”和“heroku-toolbelt”相互造成了问题,所以我决定删除 heroku-toolbelt 并将其作为 gemfile 包含在内。但是,我仍然看不到部署的应用程序有什么问题。

标签: ruby-on-rails deployment heroku


【解决方案1】:

对于初次部署的人员,以下是我遇到的问题以及我如何解决这些问题:

1. RailsInstaller 和 Heroku Toolbelt 不完全兼容:如果你在安装 Heroku toolbelt 后遇到问题,建议你把 railsinstaller 和 heroku toolbelt 一起删除,重新安装 railsinstaller。然后,在您的 gem 文件中,只需添加 gem 'heroku' 并运行 bundle install。我不需要任何额外的东西来成功部署我的应用程序。 Heroku Toolbelt 安装 ruby​​ 1.9.2 v,并根据您的偏好添加错误的路径。您可以选择手动将此 PATH 修复到正确的位置,例如 C:RailsInstaller:Ruby1.9.3,但我发现重新安装所有内容更容易。

2。您必须从 SQLite3 迁移到 PostgreSQL:如果您不确定如何操作,请关注 this

3.按照 Heroku 教程最终部署您的应用程序:关注 this。如果您收到与“对象不存在”类似的错误,请尝试运行heroku run rake db:migrate

祝你部署顺利!

【讨论】:

    猜你喜欢
    • 2021-12-16
    • 1970-01-01
    • 1970-01-01
    • 2016-04-20
    • 2022-09-27
    • 1970-01-01
    • 2012-02-23
    • 1970-01-01
    相关资源
    最近更新 更多