Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not deploy my rails app to heroku after getting asset not present in asset pipeline error

My app works fine on my localhost but now am trying to deploy it to heroku and it says:

We're sorry, but something went wrong.
If you are the application owner check the logs for more information.

Log file:

2017-07-28T06:32:05.150511+00:00 app[web.1]: F, [2017-07-28T06:32:05.150434 #4] FATAL -- : [333bb637-4f97-41fa-8b90-60452df2b4fd]   
2017-07-28T06:32:05.150586+00:00 app[web.1]: F, [2017-07-28T06:32:05.150519 #4] FATAL -- : [333bb637-4f97-41fa-8b90-60452df2b4fd] ActionView::Template::Error (The asset "landingherodrink.jpeg" is not present in the asset pipeline.):
2017-07-28T06:32:05.150803+00:00 app[web.1]: F, [2017-07-28T06:32:05.150736 #4] FATAL -- : [333bb637-4f97-41fa-8b90-60452df2b4fd]     10:                 </div>
2017-07-28T06:32:05.150806+00:00 app[web.1]: [333bb637-4f97-41fa-8b90-60452df2b4fd]     11:         </div>
2017-07-28T06:32:05.150806+00:00 app[web.1]: [333bb637-4f97-41fa-8b90-60452df2b4fd]     12:         <div id="landingherodrink">
2017-07-28T06:32:05.150808+00:00 app[web.1]: [333bb637-4f97-41fa-8b90-60452df2b4fd]     13:                 <%= image_tag("landingherodrink.jpeg") %>
2017-07-28T06:32:05.150808+00:00 app[web.1]: [333bb637-4f97-41fa-8b90-60452df2b4fd]     14:         </div>
2017-07-28T06:32:05.150809+00:00 app[web.1]: [333bb637-4f97-41fa-8b90-60452df2b4fd]     15:         <%= render 'footermenu/footermenu' %>      
2017-07-28T06:32:05.150809+00:00 app[web.1]: [333bb637-4f97-41fa-8b90-60452df2b4fd]     16: </body>
2017-07-28T06:32:05.150867+00:00 app[web.1]: F, [2017-07-28T06:32:05.150807 #4] FATAL -- : [333bb637-4f97-41fa-8b90-60452df2b4fd]   
2017-07-28T06:32:05.150971+00:00 app[web.1]: F, [2017-07-28T06:32:05.150889 #4] FATAL -- : [333bb637-4f97-41fa-8b90-60452df2b4fd] app/views/landingpage/index.html.erb:13:in `_app_views_landingpage_index_html_erb__2117924159609624554_32934860'
2017-07-28T06:43:04.237065+00:00 heroku[router]: at=info method=GET path="/" host=thawing-cliffs-75380.herokuapp.com request_id=d535ef51-8a33-41dc-b820-50e9a43ca635 fwd="207.38.188.8" dyno=web.1 connect=0ms service=6ms status=500 bytes=1827 protocol=https
2017-07-28T06:43:04.231745+00:00 app[web.1]: I, [2017-07-28T06:43:04.231639 #4]  INFO -- : [d535ef51-8a33-41dc-b820-50e9a43ca635] Started GET "/" for 207.38.188.8 at 2017-07-28 06:43:04 +0000
2017-07-28T06:43:04.232703+00:00 app[web.1]: I, [2017-07-28T06:43:04.232613 #4]  INFO -- : [d535ef51-8a33-41dc-b820-50e9a43ca635] Processing by LandingpageController#index as HTML
2017-07-28T06:43:04.233549+00:00 app[web.1]: I, [2017-07-28T06:43:04.233492 #4]  INFO -- : [d535ef51-8a33-41dc-b820-50e9a43ca635]   Rendering landingpage/index.html.erb within layouts/application
2017-07-28T06:43:04.234214+00:00 app[web.1]: I, [2017-07-28T06:43:04.234157 #4]  INFO -- : [d535ef51-8a33-41dc-b820-50e9a43ca635]   Rendered navmain/_navmain.html.erb (0.4ms)
2017-07-28T06:43:04.235218+00:00 app[web.1]: I, [2017-07-28T06:43:04.235161 #4]  INFO -- : [d535ef51-8a33-41dc-b820-50e9a43ca635]   Rendered landingpage/index.html.erb within layouts/application (1.6ms)
2017-07-28T06:43:04.235358+00:00 app[web.1]: I, [2017-07-28T06:43:04.235306 #4]  INFO -- : [d535ef51-8a33-41dc-b820-50e9a43ca635] Completed 500 Internal Server Error in 3ms
2017-07-28T06:43:04.235988+00:00 app[web.1]: F, [2017-07-28T06:43:04.235934 #4] FATAL -- : [d535ef51-8a33-41dc-b820-50e9a43ca635]   
2017-07-28T06:43:04.236030+00:00 app[web.1]: F, [2017-07-28T06:43:04.235987 #4] FATAL -- : [d535ef51-8a33-41dc-b820-50e9a43ca635] ActionView::Template::Error (The asset "landingherodrink.jpeg" is not present in the asset pipeline.):
2017-07-28T06:43:04.236172+00:00 app[web.1]: F, [2017-07-28T06:43:04.236123 #4] FATAL -- : [d535ef51-8a33-41dc-b820-50e9a43ca635]     10:                 </div>
2017-07-28T06:43:04.236174+00:00 app[web.1]: [d535ef51-8a33-41dc-b820-50e9a43ca635]     11:         </div>
2017-07-28T06:43:04.236174+00:00 app[web.1]: [d535ef51-8a33-41dc-b820-50e9a43ca635]     12:         <div id="landingherodrink">
2017-07-28T06:43:04.236175+00:00 app[web.1]: [d535ef51-8a33-41dc-b820-50e9a43ca635]     13:                 <%= image_tag("landingherodrink.jpeg") %>
2017-07-28T06:43:04.236176+00:00 app[web.1]: [d535ef51-8a33-41dc-b820-50e9a43ca635]     14:         </div>
2017-07-28T06:43:04.236176+00:00 app[web.1]: [d535ef51-8a33-41dc-b820-50e9a43ca635]     15:         <%= render 'footermenu/footermenu' %>      
2017-07-28T06:43:04.236177+00:00 app[web.1]: [d535ef51-8a33-41dc-b820-50e9a43ca635]     16: </body>
2017-07-28T06:43:04.236210+00:00 app[web.1]: F, [2017-07-28T06:43:04.236170 #4] FATAL -- : [d535ef51-8a33-41dc-b820-50e9a43ca635]   
2017-07-28T06:43:04.236253+00:00 app[web.1]: F, [2017-07-28T06:43:04.236214 #4] FATAL -- : [d535ef51-8a33-41dc-b820-50e9a43ca635] app/views/landingpage/index.html.erb:13:in `_app_views_landingpage_index_html_erb__2117924159609624554_32934860'
2017-07-28T06:43:04.335568+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=thawing-cliffs-75380.herokuapp.com request_id=00e2db2c-310c-48a1-88f9-7e3e9e302a4d fwd="207.38.188.8" dyno=web.1 connect=0ms service=1ms status=304 bytes=48 protocol=https

It also shows:

ActionView::Template::Error (The asset "landingherodrink.jpeg" is not present in the asset pipeline.).

It is my hero image and it is located at assets/images/

like image 936
craftdeer Avatar asked Jul 28 '17 06:07

craftdeer


People also ask

How do I Precompile assets Rails in Heroku?

To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.

What is the Rails asset pipeline?

1 What is the Asset Pipeline? The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass, and ERB.

What does rake assets Clean do?

rake assets:clean removes compiled assets. It is run by cap deploy:assets:clean to remove compiled assets, generally from a remote server.


2 Answers

In Rails 5+, make sure you have specified the file extension.

Ie.:

<%= image_tag 'logo.jpg' %>

instead of:

<%= image_tag 'logo' %>
like image 141
Lucas Caton Avatar answered Oct 27 '22 04:10

Lucas Caton


I'm a bit too late but just had the same issue and fixed it just by changing my image extension from .jpeg to .jpg and of course changing it also in the code.

like image 41
subparry Avatar answered Oct 27 '22 03:10

subparry