I am having issues pushing my rails project to heroku. I get a \"Precompiling assets failed\" message . I am new to programming and new to ruby on rails. I really need some
You probably already solved this by now, but I stumbled across this issue and wanted to share my solution.
As an answer above suggested, the best way to track the error down to the problematic file is to run
rake assets:precompile RAILS_ENV=production
locally while excluding files or directories you might think contain the problem. I deleted directories one by one (which I could later checkout again from my repo) until I got the precompilation running. I then drilled down into the last deleted directory and tracked it down to a certain file and a function of the form
array.find(name => name.id === user_id);
My research showed that it turns out the largest update to Javascript (ES5) was released in 2009 and since then, only unitl June 2015 was the ECMAScript 6 (ES6) final specification released. The syntax used in this function is supported by ES6 but not ES5 and ES6 is not yet supported on Rails (I was running RoR 5.0.0.1), at least not with ExecJS on the assets pipeline.
What you CAN do, is change your function to an alternative syntax, namely
array.find(function(name){return name.id === user_id});
and it should work equivalently.
find function here