UPDATE: Colin\'s suggestion of removing the line //= require_tree . has fixed the issue.
I have wasted over 2 days trying to follow every suggestion
Quick and dirty solution: remove //= require_tree . from application.js.
//= require_tree .
application.js
As I explain in the comments for the question, this doesn't actually solve the underlying issue that is causing the error, but merely sidesteps it.