Issue
after moving my Ruby on Rails app to production server (AWS EC2 Amazon Linux 2018.03) pages don't render, because of error "The asset 'application.css' is not present in the asset pipeline" (precompiled files are presents in public/assets): production.log
However, when I refresh my application (sometimes more then once), this file is found in cache and page is rendering correctly. It seems like server doesn't wait for file precompilation or something like that. It happens not only on first page entry, but every change of view.
I followed tips from post: application.css not in asset pipeline, but it didn't help.
My stack:
- ruby 2.6.3
- rails 5.2.3
- Unicorn 5.5.1
- nginx 1.14.1
I will be really grateful for any hints.
Solution
You can confirm your app/assets/stylesheets folder it should have application.css file and you will have to precompile assets in production environment before go/start server in production environment. You can precompile assets using
RAILS_ENV=production rails assets:precompile
If it still does not work then you can try the config.assets.compile option to true in production.rb so it will do live compilation. Although it should be false in production environment as it impact on performance.
config.assets.compile = true
Answered By - Praveen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.