Asset "logo.png" is not in the asset pipeline

In Rails 5.1.3 I modify the logo file in app / assets / images Then the error does not know what to fix. Somebody knows?

The asset "logo.png" is not present in the asset pipeline. 

Already try restarting rails, blank rails, rails or rails: precompile

Here are my config / initializers / assets.rb

 # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules folder to the asset load path. Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 
+23
source share
5 answers

I had a similar problem. The solution was to add the file extension to the image.

 = image_tag 'logo', alt: '' 

to

 = image_tag 'logo.jpg', alt: '' 
+24
source

Since it is not hosted here ... For me, it was as simple as restarting the Rails server.

enter image description here

+15
source

Here is what I did to solve my problem, I was not mistaken with my code, and it works:

  • The net asset cache in / tmp / assets with this command:
 $rake tmp:clear 

as said here

  1. Precompile the assets using the following command:
 $rake assets:precompile 
+3
source

Try to do it

First go to

 app/assets/images 

Second creation of folder logos

 app/assets/images/logos 

The third image for logos

 app/assets/images/logos/logo.png 

And the last placed in your application puts this code

 <%= link_to image_tag("logos/logo.png"), root_path %> 

It will be work everywhere

+1
source

This is how I solved this problem.

I used double qoutes

"<% = image_tag (" 'core-img / thumb.png' ", alt:" ")%>"

There should only be single quotes around the file name

"<% = image_tag ('core-img / thumb.png', alt:" ")%>"

Stop server

$ rake assets: precompile

and then

$ rails s

And it works!

-4
source

Source: https://habr.com/ru/post/1271466/


All Articles