0
votes

I have been following along with Michael Hartl's Rails tutorial and at the end of chapter 5 attempted to deploy my app to Heroku. I went through the usual steps and ensured that the app was running correctly locally.

When I attempted to open the app I received the following error message:

We're Sorry but something went wrong. Check logs for more information

I ran

$heroku logs 

and was given the following

(master) $ heroku logs
2016-07-03T22:04:07.236612+00:00 app[web.1]:      5:   <%= stylesheet_link_tag        'application', media: 'all', 'data-turbolinks-track' => true %>
2016-07-03T22:04:07.236617+00:00 app[web.1]:     10: <body>
2016-07-03T22:04:07.236610+00:00 app[web.1]:   * "/app/app/views"
2016-07-03T22:04:07.236614+00:00 app[web.1]:      6:   <%=     javascript_include_tag 'application', 'data-turbolinks-track' => true %>
2016-07-03T22:04:07.236617+00:00 app[web.1]:      9: </head>
2016-07-03T22:04:07.236615+00:00 app[web.1]:      7:   <%= csrf_meta_tags %>
2016-07-03T22:04:07.236611+00:00 app[web.1]: ):
2016-07-03T22:04:07.236609+00:00 app[web.1]: ActionView::Template::Error       (Missing partial layouts/_shim with {:locale=>[:en], :formats=>[:html],     :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}.     Searched in:
2016-07-03T22:04:07.236620+00:00 app[web.1]: 
2016-07-03T22:04:07.236616+00:00 app[web.1]:      8:   <%= render     "layouts/shim" %>
2016-07-03T22:04:07.236618+00:00 app[web.1]:     11:   <%= render     'layouts/header' %>
2016-07-03T22:04:07.236619+00:00 app[web.1]:       app/views/layouts/application.html.erb:8:in     `_app_views_layouts_application_html_erb___1308690014084623887_70181780339020'
2016-07-03T22:04:07.236620+00:00 app[web.1]: 
2016-07-03T22:04:07.332794+00:00 heroku[router]: at=info method=GET     path="/favicon.ico" host=shielded-ocean-69345.herokuapp.com request_id=2b98b854-    e544-4a7a-b84c-17a9f523a784 fwd="96.250.10.105" dyno=web.1 connect=0ms service=5ms     status=304 bytes=48
2016-07-03T22:04:07.209635+00:00 heroku[router]: at=info method=GET path="/"     host=shielded-ocean-69345.herokuapp.com request_id=8414c14f-a2ea-4828-af90-    c94f46993f87 fwd="96.250.10.105" dyno=web.1 connect=0ms service=26ms status=500     bytes=1669
2016-07-03T22:08:00.831461+00:00 app[web.1]: Started GET "/" for 96.250.10.105     at 2016-07-03 22:08:00 +0000
2016-07-03T22:08:00.813784+00:00 heroku[router]: at=info method=GET path="/"     host=shielded-ocean-69345.herokuapp.com request_id=8b549d7c-caf4-4cee-81e7-    4df74e237ede fwd="96.250.10.105" dyno=web.1 connect=1ms service=26ms status=500     bytes=1669
2016-07-03T22:08:00.843662+00:00 app[web.1]:   * "/app/app/views"
2016-07-03T22:08:00.835335+00:00 app[web.1]: Processing by     StaticPagesController#home as HTML
2016-07-03T22:08:00.843652+00:00 app[web.1]: 
2016-07-03T22:08:00.842200+00:00 app[web.1]: Completed 500 Internal Server     Error in 7ms (ActiveRecord: 0.0ms)
2016-07-03T22:08:00.843665+00:00 app[web.1]:      5:   <%= stylesheet_link_tag        'application', media: 'all', 'data-turbolinks-track' => true %>
2016-07-03T22:08:00.843663+00:00 app[web.1]: ):
2016-07-03T22:08:00.838459+00:00 app[web.1]:   Rendered     static_pages/home.html.erb within layouts/application (1.0ms)
2016-07-03T22:08:00.843661+00:00 app[web.1]: ActionView::Template::Error     (Missing partial layouts/_shim with {:locale=>[:en], :formats=>[:html],     :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}.     Searched in:
2016-07-03T22:08:00.843667+00:00 app[web.1]:      7:   <%= csrf_meta_tags %>
2016-07-03T22:08:00.843669+00:00 app[web.1]:      8:   <%= render     "layouts/shim" %>
2016-07-03T22:08:00.843669+00:00 app[web.1]:      9: </head>
2016-07-03T22:08:00.843666+00:00 app[web.1]:      6:   <%=     javascript_include_tag 'application', 'data-turbolinks-track' => true %>
2016-07-03T22:08:00.843673+00:00 app[web.1]: 
2016-07-03T22:08:00.843672+00:00 app[web.1]:       app/views/layouts/application.html.erb:8:in     `_app_views_layouts_application_html_erb___1308690014084623887_70181780339020'
2016-07-03T22:08:00.843673+00:00 app[web.1]: 
2016-07-03T22:08:00.843670+00:00 app[web.1]:     10: <body>
2016-07-03T22:08:00.843671+00:00 app[web.1]:     11:   <%= render     'layouts/header' %>
2016-07-03T22:08:00.865455+00:00 heroku[router]: at=info method=GET      path="/favicon.ico" host=shielded-ocean-69345.herokuapp.com request_id=4d3005d1-     72e7-4f9d-bb0a-daef11fcb7d3 fwd="96.250.10.105" dyno=web.1 connect=0ms service=3ms      status=304 bytes=48
2016-07-03T22:12:19.033956+00:00 heroku[slug-compiler]: Slug compilation     started
2016-07-03T22:12:19.033964+00:00 heroku[slug-compiler]: Slug compilation     failed: failed to compile Ruby app
2016-07-03T22:13:49.911337+00:00 heroku[slug-compiler]: Slug compilation     failed: failed to compile Ruby app
2016-07-03T22:13:49.911326+00:00 heroku[slug-compiler]: Slug compilation     started
2016-07-03T22:14:53.615406+00:00 heroku[slug-compiler]: Slug compilation finished
2016-07-03T22:14:53.615398+00:00 heroku[slug-compiler]: Slug compilation started
2016-07-03T22:14:53.441497+00:00 heroku[api]: Release v9 created by     
2016-07-03T22:14:53.441423+00:00 heroku[api]: Deploy a287285 by 
2016-07-03T22:14:53.700320+00:00 heroku[web.1]: Restarting
2016-07-03T22:14:57.223797+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-07-03T22:14:57.232743+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 15046 -e production`
2016-07-03T22:14:58.065862+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2016-07-03T22:14:58.066171+00:00 app[web.1]: === puma shutdown: 2016-07-03 22:14:58 +0000 ===
2016-07-03T22:14:58.066206+00:00 app[web.1]: - Goodbye!
2016-07-03T22:14:58.066269+00:00 app[web.1]: Exiting
2016-07-03T22:14:59.302443+00:00 heroku[web.1]: Process exited with status 0
2016-07-03T22:15:01.107923+00:00 app[web.1]: => Booting Puma
2016-07-03T22:15:01.107985+00:00 app[web.1]: => Rails 4.2.2 application starting in production on http://0.0.0.0:15046
2016-07-03T22:15:01.107999+00:00 app[web.1]: => Ctrl-C to shutdown server
2016-07-03T22:15:01.107995+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-07-03T22:15:01.691975+00:00 app[web.1]: Puma starting in single mode...
2016-07-03T22:15:01.691991+00:00 app[web.1]: * Version 3.1.0 (ruby 2.2.4-p230), codename: El Niño Winter Wonderland
2016-07-03T22:15:01.691993+00:00 app[web.1]: * Min threads: 0, max threads: 16
2016-07-03T22:15:01.691994+00:00 app[web.1]: * Environment: production
2016-07-03T22:15:01.692097+00:00 app[web.1]: * Listening on  tcp://0.0.0.0:15046
2016-07-03T22:15:01.692333+00:00 app[web.1]: Use Ctrl-C to stop
2016-07-03T22:15:11.972090+00:00 app[web.1]: ActionView::Template::Error  (Missing partial layouts/_shim with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
2016-07-03T22:15:11.969112+00:00 app[web.1]:   Rendered static_pages/home.html.erb within layouts/application (1.5ms)
2016-07-03T22:15:11.971214+00:00 app[web.1]: Completed 500 Internal Server Error in 20ms (ActiveRecord: 0.0ms)
2016-07-03T22:15:11.911510+00:00 app[web.1]: Started GET "/" for 96.250.10.105 at 2016-07-03 22:15:11 +0000
2016-07-03T22:15:11.951234+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2016-07-03T22:15:11.972091+00:00 app[web.1]:   * "/app/app/views"
2016-07-03T22:15:11.972092+00:00 app[web.1]: ):
2016-07-03T22:15:11.972080+00:00 app[web.1]: 
2016-07-03T22:15:11.972093+00:00 app[web.1]:      5:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
2016-07-03T22:15:11.972096+00:00 app[web.1]:      9: </head>
2016-07-03T22:15:11.972097+00:00 app[web.1]:     10: <body>
2016-07-03T22:15:11.972098+00:00 app[web.1]:   app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb___1593092074937796530_70210269730920'
2016-07-03T22:15:11.972099+00:00 app[web.1]: 
2016-07-03T22:15:11.972097+00:00 app[web.1]:     11:   <%= render 'layouts/header' %>
2016-07-03T22:15:11.972094+00:00 app[web.1]:      6:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
2016-07-03T22:15:11.972094+00:00 app[web.1]:      7:   <%= csrf_meta_tags %>
2016-07-03T22:15:11.972095+00:00 app[web.1]:      8:   <%= render "layouts/shim" %>
2016-07-03T22:15:11.972100+00:00 app[web.1]: 
2016-07-03T22:15:11.999714+00:00 heroku[router]: at=info method=GET path="/" host=shielded-ocean-69345.herokuapp.com request_id=43050116-0f99-423b-88f1-46d62700857f fwd="96.250.10.105" dyno=web.1 connect=0ms service=66ms status=500 bytes=1669
2016-07-03T22:15:12.052653+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=shielded-ocean-69345.herokuapp.com request_id=6ffdd04c-53c8-4383-a095-1d34f0ab155c fwd="96.250.10.105" dyno=web.1 connect=0ms service=2ms status=200 bytes=143
2016-07-03T22:16:19.702633+00:00 heroku[router]: at=info method=GET path="/" host=shielded-ocean-69345.herokuapp.com request_id=75bbacb3-3bd6-4d49-877f-1d8155eb5ba8 fwd="96.250.10.105" dyno=web.1 connect=1ms service=8ms status=500 bytes=1669
2016-07-03T22:16:19.696865+00:00 app[web.1]: Started GET "/" for 96.250.10.105     at 2016-07-03 22:16:19 +0000
2016-07-03T22:16:19.698826+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2016-07-03T22:16:19.700097+00:00 app[web.1]:   Rendered static_pages/home.html.erb within layouts/application (0.5ms)
2016-07-03T22:16:19.704512+00:00 app[web.1]: 
2016-07-03T22:16:19.704537+00:00 app[web.1]: ActionView::Template::Error (Missing partial layouts/_shim with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
2016-07-03T22:16:19.704540+00:00 app[web.1]:   * "/app/app/views"
2016-07-03T22:16:19.704540+00:00 app[web.1]: ):
2016-07-03T22:16:19.704541+00:00 app[web.1]:      5:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
2016-07-03T22:16:19.701766+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.0ms)
2016-07-03T22:16:19.704543+00:00 app[web.1]:      7:   <%= csrf_meta_tags %>
2016-07-03T22:16:19.704542+00:00 app[web.1]:      6:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
2016-07-03T22:16:19.704545+00:00 app[web.1]:      9: </head>
2016-07-03T22:16:19.704544+00:00 app[web.1]:      8:   <%= render "layouts/shim" %>
2016-07-03T22:16:19.704545+00:00 app[web.1]:     10: <body>
2016-07-03T22:16:19.704546+00:00 app[web.1]:     11:   <%= render 'layouts/header' %>
2016-07-03T22:16:19.704548+00:00 app[web.1]: 
2016-07-03T22:16:19.704547+00:00 app[web.1]:   app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb___1593092074937796530_70210269730920'
2016-07-03T22:16:19.704548+00:00 app[web.1]: 
2016-07-03T22:16:19.758932+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=shielded-ocean-69345.herokuapp.com request_id=66c5443b-55f1-4d26-a231-f68b68fa32e0 fwd="96.250.10.105" dyno=web.1 connect=1ms service=2ms status=304 bytes=48

The following is the contents of my application.html.erb file:

<!DOCTYPE html>
<html>
<head>
   <title><%= full_title(yield(:title)) %></title>
   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-   track' => true %>
   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
   <%= csrf_meta_tags %>
   <%= render 'layouts/shim' %>
 </head>
 <body>
    <%= render 'layouts/header' %>
    <div class="container">
       <%= yield %>
       <%= render "layouts/footer" %>
    </div>
</body>
</html>

Here are the contents of the _shim file being referenced:

<!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html15.min.js">
    </script>
<![endif]-->

I know this is messy but looking through this I am not sure what the issue is. I was hoping someone more experienced would be able to point me in the right direction.

Thank you

4
can you please add you application.html.erb file?Nirupa
you should add this to your question. I'm sorry but it's difficult to read the file in comments.Nirupa

4 Answers

2
votes

This is the error:

ActionView::Template::Error (Missing partial layouts/_shim with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:

You are missing shim partial in your main layouts, create the shim partial as it is called in main layout file.

1
votes

From the logs it looks like you are missing or have misplaced your shim partial, since the app can't find it. In Rails file names for partials begin with an underscore like so: '_shim.html.erb'

0
votes

Please update your application.html.erb file as below before deploying to heroku:

<!DOCTYPE html>
<html>
  <head>
    <title><%= full_title(yield(:title)) %></title>
    <%= render 'layouts/rails_default' %>
    <%= render 'layouts/shim' %>
  </head>
  <body>
    <%= render 'layouts/header' %>
    <div class="container">
      <%= yield %>
      <%= render 'layouts/footer' %>
    </div>
  </body>
</html>
0
votes

I had the same error message on Heroku though the app ran locally (on cloud9). It turns out the file could not be found by Heroku because I had limited my git commits to git commit -am 'message'. As a result I had not committed any newly created files (git commit -am only commits modified files, not newly created files). Try running git add . and then committing. That should allow Heroku to 'see' the file it is missing.

It may be too late to answer your question but hopefully this may help someone searching for an answer to this problem - like I was.