2

我刚刚将我的 Rails 应用程序推送到 Heroku。然后我运行 heroku db:migrate 然后 heroku db:push。但是当我打开应用程序时,我收到错误消息“应用程序发生错误,无法提供您的页面。请稍后再试。如果您是应用程序所有者,请查看您的日志以获取详细信息”。

所以我运行了heroku日志,这就是我得到的:

$ heroku logs
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
2013-05-10T17:13:21.460325+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': /app/app/controllers/users_controller.rb:54: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
2013-05-10T17:13:21.460325+00:00 app[web.1]:         redirect_to signin_url, notice: t "user.please"
2013-05-10T17:13:21.460325+00:00 app[web.1]:         ^
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
2013-05-10T17:13:21.460325+00:00 app[web.1]: Exiting
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:313:in `depend_on'
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:225:in `require_dependency'
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:438:in `each'
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:359:in `require_
or_load'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'

2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
2013-05-10T17:13:21.461416+00:00 app[web.1]:    from script/rails:6:in `require'

2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config.ru:in `new'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config/environment.rb:
5:in `<top (required)>'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config.ru:3:in `requir
e'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config.ru:3:in `block
in <main>'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'

2013-05-10T17:13:21.461416+00:00 app[web.1]:    from script/rails:6:in `<main>'
2013-05-10T17:13:23.235761+00:00 heroku[web.1]: State changed from starting to c
rashed
2013-05-10T17:13:23.221686+00:00 heroku[web.1]: Process exited with status 1
2013-05-10T17:13:23.237632+00:00 heroku[web.1]: State changed from crashed to st
arting
2013-05-10T17:13:24.507187+00:00 heroku[web.1]: Starting process with command `b
undle exec rails server -p 10305`
2013-05-10T17:13:27.937367+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 Gemfile, or fold them in to
your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release
notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-h
as-been-released. (called from <top (required)> at /app/config/environment.rb:5)

2013-05-10T17:13:27.935835+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 Gemfile, or fold them in to
your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release
notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-h
as-been-released. (called from <top (required)> at /app/config/environment.rb:5)

2013-05-10T17:13:27.938348+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 Gemfile, or fold them in to
your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release
notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-h
as-been-released. (called from <top (required)> at /app/config/environment.rb:5)

2013-05-10T17:13:31.274313+00:00 app[web.1]: => Booting WEBrick
2013-05-10T17:13:31.274313+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-05-10T17:13:31.274313+00:00 app[web.1]: => Call with -d to detach
2013-05-10T17:13:31.274313+00:00 app[web.1]: => Rails 3.2.12 application startin
g in production on http://0.0.0.0:10305
2013-05-10T17:13:31.274313+00:00 app[web.1]: Connecting to database specified by
 DATABASE_URL
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/application/finisher.rb:53:in `block in <modul
e:Finisher>'
2013-05-10T17:13:31.511810+00:00 app[web.1]:         redirect_to signin_url, not
ice: t "user.please"
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'

2013-05-10T17:13:31.511810+00:00 app[web.1]:
        ^
2013-05-10T17:13:31.511810+00:00 app[web.1]: Exiting
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:359:in `require_
or_load'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engin
e.rb:439:in `block (2 levels) in eager_load!'
2013-05-10T17:13:31.511810+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/
activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': /app/a
pp/controllers/users_controller.rb:54: syntax error, unexpected tSTRING_BEG, exp
ecting keyword_do or '{' or '(' (SyntaxError)
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'

2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config.ru:3:in `requir
e'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engine.rb:438:in `block in eager_load!'
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dep
endency'
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in
 require'
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:225:in `require_
dependency'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engine.rb:436:in `eager_load!'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializ
ers'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config/environment.rb:
5:in `<top (required)>'
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:313:in `depend_o
n'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config.ru:in `new'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>'
2013-05-10T17:13:31.512991+00:00 app[web.1]:    from script/rails:6:in `<main>'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engine.rb:438:in `each'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
2013-05-10T17:13:31.512991+00:00 app[web.1]:    from script/rails:6:in `require'

2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engine.rb:436:in `each'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config.ru:3:in `block
in <main>'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
2013-05-10T17:13:42.307007+00:00 heroku[web.1]: Process exited with status 1
2013-05-10T17:13:42.323377+00:00 heroku[web.1]: State changed from starting to c
rashed
2013-05-10T17:13:55.228036+00:00 heroku[api]: Starting process with command `bun
dle exec rake db:migrate` by muyiwamat@gmail.com
2013-05-10T17:13:57.306953+00:00 heroku[run.6043]: Awaiting client
2013-05-10T17:13:57.324094+00:00 heroku[run.6043]: Starting process with command
 `bundle exec rake db:migrate`
2013-05-10T17:13:58.232657+00:00 heroku[run.6043]: State changed from starting t
o up
2013-05-10T17:14:06.400819+00:00 heroku[run.6043]: Process exited with status 0
2013-05-10T17:14:06.419565+00:00 heroku[run.6043]: State changed from up to comp
lete
2013-05-10T17:17:30.518444+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path=/ host=immense-refuge-9281.herokuapp.com fwd="94.116.4.100
" dyno= connect= service= status=503 bytes=
2013-05-10T17:17:30.975159+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path=/favicon.ico host=immense-refuge-9281.herokuapp.com fwd="9
4.116.4.100" dyno= connect= service= status=503 bytes=

我几乎无法理解这里的这些文件。有什么我可能做错了吗?我正在使用 Rails 3.2,并且我已经确定我使用了 heroku --stack cedar,因为我在某处读到 heroku 仅支持 cedar 堆栈上的 Rails 3。

--UPDATE-- 根据 Leo Correa 的要求,下面是我的 users_controller.rb 的片段

def signed_in_user
     unless signed_in?
        store_location
        redirect_to (signin_url, notice: t("user.please")) 
     end
    end
4

3 回答 3

3

这似乎是一个语法错误,您可能会遗漏大括号或括号之类的内容

/app/app/controllers/users_controller.rb:54: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
2013-05-10T17:13:21.460325+00:00 app[web.1]:         redirect_to signin_url, notice: t "user.please"

那个大块给了它。因此,在第 54 行的 users_controller 中的某处。尝试这样做

redirect_to(signing_url, notice: t('user.please'))
于 2013-05-10T17:37:09.757 回答
1

我认为这是您需要添加的资产预编译config.assets.initialize_on_precompile = false问题config/application.rb。如果添加在config/environments/production.rb

从您的日志看来,语法错误如下:

redirect_to(signing_url, notice: t('user.please'))

我认为您正在使用Devise Gem检查您的代码。

于 2013-05-10T18:16:16.053 回答
0

您可能会使用 heroku 的免费帐户。当您使用 heroku 的免费帐户时,您每天只能使用 18 小时,然后自动进入睡眠状态或筋疲力尽。发生这种情况时,您将收到此错误页面。如果您的网站繁忙,请尝试将帐户跳过为爱好类型。

于 2016-03-17T04:50:06.313 回答