This is the full error:
Asset was not declared to be precompiled in production.
Add `Rails.application.config.assets.precompile += %w( tutorial.js )` to `config/initializers/assets.rb` and restart your server
When the server starts up, it say that it's in development:
=> Booting Puma
=> Rails 5.1.7 application starting in development
Sometimes clearing the tmp can help. rake tmp:clear
I have declared in my assets.rb
Rails.application.config.assets.precompile += %w( ckeditor/* )
I have also precompiled my assets for production, the heroku logs don't give any errors and on my heroku server instead of getting cktext_area i get simple text_area
I updated my Spree Commerce app to include the spree_fancy theme (which works locally) and after pushing the changes to git and running cap deploy the page now displays the error message "we're sorry but something went wrong".
I looked in the production.log file but all I see are lists and lists of rendered stuff and no errors. Only 200 OK and 301 moved permanently messages.
I rebooted the server and did rake db:migrate. Both did not help.
How do I go about finding what went wrong?
//UPDATE
I've added I've added config.consider_all_requests_local = true to production.rb, did a rollback and a deploy and now I see an error message in the browser (this is not in the production.log...):
Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in
Spree/home#index
store/print.css isn't precompiled
I searched the internet and added the following to production.rb:
config.assets.precompile += %w( store/shared/_print.css )
but this did not help. I also added the print.css file to /public/assets/stylesheets/store/ and precompiled with RAILS_ENV=production bundle exec rake assets:precompile but that did not work either.
Does anyone have another idea what to do?
Using RAILS_ENV=production bundle exec rake assets:precompile. Thanks!
I'm attempting to deploy a web application on Amazon's EC2 servers, and I have the code up on the server. Everything looks like it's working, but when I go to the home page, I get a 500 error message and the production.log file gives me the following error:
ActionView::Template::Error (image.png isn't precompiled)
I've tried running rake assets:precompile,
I've changed the line in config/environments/production.rb to config.assets.compile = true
I've checked that the compiled image.png is in public/assets/manifest.yml
but I still get the same error.
I'm running Rails 3.2.6 and Ruby 1.8.7.
Thanks for your help!
Running rake assets:precompile RAILS_ENV=production should fix it.
If you don't provide any RAILS_ENV, Rails assumes it's development
I believe that's because each env in the asset pipeline behaves differently. Therefore, as a general rule, in production, always run rake tasks with RAILS_ENV='production' and you should stay safe.
I am using Openshift from Redhat and when deployed on the server it RAKEs to the production environment automatically. I too had the same problem but only on the production server.
Performing the change:
config/environments/production.rb to config.assets.compile = true
worked a treat. There is another parameter in this file vou could change:
config.assets.precompile += %w[ *.png *.jpeg *.jpg *.gif ]
When deployed on the server you could then do manually:
rake RAILS_ENV=production
or if you are using a server like Openshift that deploys automatically, configurations in the production.rb file will be taken into account.
In config/application.rb add a line like:
config.assets.precompile += ['image.png']
Although, if its in public/assets/images you shouldn't have to.
Resolved - needed to run rake assets:precompile RAILS_ENV='production instead of just rake assets:precompile ...
I'm using Rails on Heroku Cedar stack and it's not throwing any issues while compiling the assets but then I get a 500 internal server error:
2012-06-25T23:22:59+00:00 app[web.1]: ActionView::Template::Error (bootstrap-datepicker.js isn't precompiled):
Any idea what might be causing this? This is the javascript file I'm including (except I downloaded it locally) https://github.com/eternicode/bootstrap-datepicker/blob/master/js/bootstrap-datepicker.js
I'm including it in my application.html.erb like so:
<%= javascript_include_tag "bootstrap-datepicker" %>
Is it because its not a coffeescript file? Any help is appreciated!
I figured it out. I had to add it to production.rb in config.assets.precompile
In production.rb I added it to my config.assets.precompile:
config.assets.precompile += %w( jquery.dataTables.min.js jquery-ui-1.8.21.custom.min.js jquery-ui-1.8.21.custom.css bootstrap-datepicker.js fullcalendar.js)