У меня есть приложение, которое работает локально, но не работает с синтаксической ошибкой на heroku, в файле, синтаксис которого успешно подтвержден моей локальной версией ruby.
Приложение является новым приложением Rails 3.1. Работает локально.
Я просто попытался подтолкнуть его к героку (впервые для этого приложения). Я уверен, что весь код был передан и передан герою.
Миграция (heroku run rake db:migrate
) сработала.
Когда я попытался запустить приложение, я получил страницу с ошибкой. Вот выдержка из логов. Полные логи с консоли в конце этого вопроса.
2012-01-09T21:31:36+00:00 app[web.1]: Exiting
2012-01-09T21:31:36+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require': /app/app/controllers/ios_applications_controller.rb:32: syntax error, unexpected tASSOC, expecting ')' (SyntaxError)
2012-01-09T21:31:36+00:00 app[web.1]: ...on_path ( :bundle_identifier => params[:bundle_identifier] )...
2012-01-09T21:31:36+00:00 app[web.1]: ... ^
2012-01-09T21:31:36+00:00 app[web.1]: /app/app/controllers/ios_applications_controller.rb:32: syntax error, unexpected ')', expecting keyword_end
2012-01-09T21:31:36+00:00 app[web.1]: ...=> params[:bundle_identifier] ), :notice => "No iOS applicat...
2012-01-09T21:31:36+00:00 app[web.1]: ... ^
Обратите внимание на странный путь app/app/...
(локально у меня нет этой странной структуры). Это похоже на этот вопрос (без полезных ответов).
Вот соответствующий код файла ios_applications_controller.rb
:
def show
@ios_application = IosApplication.find(params[:id]) if (params[:id])
@ios_application = IosApplication.find_by_application_bundle_identifier(params[:bundle_identifier]) if @ios_application.nil? && params[:bundle_identifier]
if @ios_application.nil?
# The line below is the mentioned line (32)
redirect_to new_ios_application_path ( :bundle_identifier => params[:bundle_identifier] ), :notice => "No iOS application found for #{params[:bundle_identifier]}. Would you like to create it?"
# This does not work either:
# redirect_to new_ios_application_path, :bundle_identifier => params[:bundle_identifier], :notice => "No iOS application found for #{params[:bundle_identifier]}. Would you like to create it?"
return
end
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @ios_application }
end
end
Проверка синтаксиса файла не показывает ошибок:
$ ruby -wc app/controllers/ios_applications_controller.rb
Syntax OK
Локально я использую ruby 1.8.7 и Rails 3.1.3.
На героку я использую кедровую стопку:
$ heroku stack
aspen-mri-1.8.6
bamboo-mri-1.9.2
bamboo-ree-1.8.7
* cedar (beta)
Полные журналы:
$ heroku logs --tail
2012-01-09T21:31:21+00:00 heroku[api]: Add-on add logging:basic by guillaume@macmation.com
2012-01-09T21:31:21+00:00 heroku[api]: Release v5 created by guillaume@macmation.com
2012-01-09T21:31:22+00:00 heroku[web.1]: State changed from crashed to created
2012-01-09T21:31:22+00:00 heroku[web.1]: State changed from created to starting
2012-01-09T21:31:28+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 55950`
2012-01-09T21:31:36+00:00 app[web.1]: => Booting WEBrick
2012-01-09T21:31:36+00:00 app[web.1]: => Rails 3.1.3 application starting in production on http://0.0.0.0:55950
2012-01-09T21:31:36+00:00 app[web.1]: => Call with -d to detach
2012-01-09T21:31:36+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-01-09T21:31:36+00:00 app[web.1]: Exiting
2012-01-09T21:31:36+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require': /app/app/controllers/ios_applications_controller.rb:32: syntax error, unexpected tASSOC, expecting ')' (SyntaxError)
2012-01-09T21:31:36+00:00 app[web.1]: ...on_path ( :bundle_identifier => params[:bundle_identifier] )...
2012-01-09T21:31:36+00:00 app[web.1]: ... ^
2012-01-09T21:31:36+00:00 app[web.1]: /app/app/controllers/ios_applications_controller.rb:32: syntax error, unexpected ')', expecting keyword_end
2012-01-09T21:31:36+00:00 app[web.1]: ...=> params[:bundle_identifier] ), :notice => "No iOS applicat...
2012-01-09T21:31:36+00:00 app[web.1]: ... ^
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in `load_dependency'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:348:in `require_or_load'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:302:in `depend_on'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:214:in `require_dependency'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:416:in `each'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:416:in `block in eager_load!'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:414:in `each'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:414:in `eager_load!'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application/finisher.rb:51:in `block in <module:Finisher>'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/config.ru:4:in `block in <main>'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/config.ru:1:in `new'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/config.ru:1:in `<main>'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:40:in `eval'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:40:in `parse_file'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.3.6/lib/rack/server.rb:200:in `app'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands/server.rb:46:in `app'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.3.6/lib/rack/server.rb:301:in `wrapped_app'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.3.6/lib/rack/server.rb:252:in `start'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:54:in `block in <top (required)>'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:49:in `tap'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:49:in `<top (required)>'
2012-01-09T21:31:36+00:00 app[web.1]: from script/rails:6:in `require'
2012-01-09T21:31:36+00:00 app[web.1]: from script/rails:6:in `<main>'
2012-01-09T21:31:36+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands/server.rb:70:in `start'
2012-01-09T21:31:37+00:00 heroku[web.1]: State changed from starting to crashed
2012-01-09T21:31:38+00:00 heroku[web.1]: Process exited
2012-01-09T21:41:11+00:00 heroku[web.1]: State changed from crashed to created
2012-01-09T21:41:11+00:00 heroku[web.1]: State changed from created to starting
2012-01-09T21:41:23+00:00 heroku[web.1]: State changed from starting to crashed