1

I'm very new to coding and I am currently going through a ruby on rails course.

I'm currently trying to deploy to heroku but I keep getting an error

remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to polar-forest-19639.

I've searched through several forums and tried different suggestions with no luck. Any help would be greatly appreciated as I can't really proceed with this course until I figure this out.

Siong Thye Goh
  • 3,518
  • 10
  • 23
  • 31
  • Do you see any logs? I’m not familiar with Heroku, but precompiling assets should mean its running `RAILS_ENV=production rake assets:precompile`. What happens if you try to run that exact command locally? Does it generate a few css and js files (and probably some files with a .gz extension)? – Nate Feb 22 '19 at 04:55
  • I was able to run that command and no errors came back. but when I try pushing to heroku I'm getting the error – Timothy Gee Feb 22 '19 at 05:09
  • Can you follow this and try to see if there are errors in the log? https://stackoverflow.com/q/2671454/10068463 – Nate Feb 22 '19 at 05:16
  • Can you please post the full error message including the stack track? Same for the log entries written when you try to deploy. – spickermann Feb 22 '19 at 07:19
  • Please post the full error message log (atleast the last last 100 lines or so). While you doing so, you could try as a quickfix: inside config/application.rb, add config.assets.initialize_on_precompile = false But again, to fully understand whats going on, post more of your log. – Prometheus Feb 22 '19 at 08:36
  • here is the full log from when i deploy to Heroku: https://drive.google.com/file/d/1-0ofLAkhEvio51q5bCPM75C_UNaWELdb/view?usp=sharing – Timothy Gee Feb 22 '19 at 19:12
  • Anybody have any ideas of what I'm doing wrong here? – Timothy Gee Feb 28 '19 at 19:55

1 Answers1

0

add in config/initializers/assets.rb

Rails.application.config.assets.precompile += %w( *.js *.es6 *.css )
Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg) 

if you used the vendor or lib folder add this:

Rails.application.config.assets.paths << Rails.root.join('lib')
Rails.application.config.assets.paths << Rails.root.join('vendor')