I have an image named pt_homepage_banner1.png.
I ran the task on production
bundle exec rake assets:precompile
and it successfully placed the image file into public/assets folder and made and entry into manifest.yml
Still i am getting exception -
Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError
fpt_homepage_banner1.png isn't precompiled
My production.rb settings are
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
Please answer what i am missing. if any clarification regarding the question, please ask
Thank you
I also got the same error,
Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError b-error.png isn't precompiled.
In my app I am calling this image, but in my images/ folder it was not there. So I added it and precompiled it again, so that the file appeared in public/assets folder. But I still gets the same error. So I know that Rails is somewhat stuck with this file, so what I did is I changed the b-error.png to 500.png and used another image and precompiled.
Now it Works!
Set following in config/environments/production.rb
config.serve_static_assets = true
config.assets.compile = true
Related
I have precompiled the assets in production but the application is not able to load the assets. My app is deployed on AWS EC2
I checked in the server in public/assets folder the application.css is present.
but still it says 404 error.
My production.rb configuration is
My nginx.conf settings are:
The 404 is based on that line in your config: config.serve_static_files = true. That might be the wrong name depending on your rails version. I believe that setting is named config.serve_static_assets in Rails prior to version 5.
If you don't have a server (nginx/etc) then you want that setting to be true. Otherwise you need to reconfigure your server to point at your /public directory, and make sure rake assets:precompile runs successfully.
I had the same problem
set config.assets.compile = True
It works for me.
The problem was my configuration in nginx of root path was wrong. so assets were not pointing to wrong path.
I changed in nginx.conf:
from root /home/deploy/appname/public
to root /home/deploy/appname/current/public
AND in production.rb
config.serve_static_assets = true to config.serve_static_assets = false
I did the same as you:
root /home/deploy/appname/public root => /home/deploy/appname/current/public
And that works for me. With the unique difference that i left the config/production.rb file like this:
config.public_file_server.enabled = true
config.assets.compile = true
I'm using Rails 5.
I'm new to web development, and I've been working on a simple app for learning purposes. I've been able to deploy to Heroku from my local machine, but for some reason, the custom classes that I use for some vector images aren't rendering on Heroku.
This is my page, and as you can see, there are just squares where there should be different images. Looking in the inspector, you see the following errors:
Failed to load resource: the server responded with a status of 404 (Not Found) - https://enigmatic-hollows-2702.herokuapp.com/assets/flaticon.woff
Failed to load resource: the server responded with a status of 404 (Not Found) https://enigmatic-hollows-2702.herokuapp.com/assets/flaticon.ttf
I have tried recompiling assets, recommitting, and pushing to Heroku, but this error persists. What's weird is that if I use Heroku Bash and view the Heroku file directory, it looks like the files are there:
But they are still throwing up that error in the inspector. I've also got the following set in my production.rb file:
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = true
config.assets.compile = true
config.assets.js_compressor = :uglifier
Any idea what could be causing this asset issue? I'm using Rails 4.2.0.
I was able to answer my own question after reading through this link. Essentially, I moved the font files out of my CSS directory and into their own fonts directory under the app/assets directory, and then in production.rb added the following line to the Application class:
config.assets.paths << Rails.root.join("app", "assets", "fonts")
and presto! It worked. I didn't mess around with #font-face in CSS, since the assets I'm using from flat-icons are built through custom classes used in span or div blocks.
I'm starting in rails and I've got an application that is working in dev (webrick).
The problem is: the precompiled CSS file is not found in production.
Now I host it on heroku and deploy it. I have a message saying that assets are precompiled (so it's not a compilation error) and everything is by-default for settings.
I've ls the /public/assets folder and everything is in there. I can even cat the application-*.css file and I get the full content I should have.
Now when I try to access the CSS file it gives me an error 404 (even tho it's an auto-generated css link usingĀ <%= stylesheet_link_tag "application", :media => "all" %>). So definetly it's not a problem that I did hardcode the CSS link.
I'm not exactly sure on what would be the next check to perform.
If you're curious on the output, it is currently publicly accessible here.
Try changing the configuration option config.serve_static_assets = false to config.serve_static_assets = true in your config/environments/production.rb if you haven't already done that.
The only thing that fixed it for me in Rails 4 was
config.assets.compile = true
in config/environments/production.rb
This would fall back to the assets pipeline if a precompiled asset is missed, according to the documentation.
I am using rails 3.2.6 and my development.rb file has
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
and for some reason evertime i look in my public folder I have an assets folder that keeps appearing....I keep deleting it but it keeps reappearing ....is there a way to stop this
The main problem is the assets are being declared twice, once in the assets folder and once in the public folder which is an exact duplicate...this is messing things up for me
in application.rb
config.assets.enabled = false
Solved....I was my guard file compiling the assets
I commented out
guard 'rails-assets' do
watch(%r{^app/assets/.+$})
watch('config/application.rb')
end
And all is well
I have a few .swf files that are being added to a project via a git submodule. They live in /vendor/private/widget/
To get the .swf files into the asset pipeline I'm doing the following:
config.assets.paths << "#{Rails.root}/vendor/private/widget"
In development this works just fine, but in production I get the following error:
ActionView::Template::Error (widget.swf isn't precompiled):
After searching around StackOverflow, I've tried these two solutions, both of which did not work:
config.assets.precompile << '*.swf'
config.assets.compile = true
Try setting application.rb 's
config.assets.digest = true
to
config.assets.digest = false
for the precompile, and flip it back to true afterwards. I don't know why this works or what part of the url digest would be preventing the asset inclusion, but this has been the only way i've found to be able to generate my assets in production to include swf files.