So very suddenly on a production server running ruby 2.1.2p95
and rails 3.2.14
, I've started getting an error from what looks like underscore.js. This is only on this server.
Uncaught SyntaxError: Unexpected token ILLEGAL
b/c this is production the code is minified but using chrome to expand it this is where it is saying the issue is:
S.template = function(e, t, n) {
var i;
n = S.defaults({}, n, S.templateSettings);
var r = new RegExp([(n.escape || L).source, (n.interpolate || L).source, (n.evaluate || L).source].join("|") + "|$", "g"), s = 0, a = "__p+='";
e.replace(r, function(t, n, i, r, o) {
return a += e.slice(s, o).replace(O, function(e) {
return "\\" + P[e]
}), n && (a += "'+\n((__t=(" + n + "))==null?'':_.escape(__t))+\n'"), i && (a += "'+\n((__t=(" + i + "))==null?'':__t)+\n'"), r && (a += "';\n" + r + "\n__p+='"), s = o + t.length, t
}), a += "';\n", n.variable || (a = "with(obj||{}){\n" + a + "}\n"), a = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + a + "return __p;\n";
try {
i = new Function(n.variable || "obj", "_", a) // <---- right here --<<
} catch (o) {
throw o.source = a, o
}
if (t)
return i(t, S);
var l = function(e) {
return i.call(this, e, S)
};
return l.source = "function(" + (n.variable || "obj") + "){\n" + a + "}", l
}
Now obviously I have not touched the underscore.js code itself and I have tried downloading the most current version of underscore.js and still get the same thing.
Just to see if I could reproduce the error on my local machine I set the project to production
and rake assets:precompile
and I still do not get the error locally.
My guess is that this is something to do with my Gem versions or the actual environment on my server but I've been debugging these things for a while now and see no change at all.
Gemfile: (w/o unrelated gems)
gem 'rails', '3.2.14'
gem 'json'
group :assets do
gem 'sprockets'
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'haml_coffee_assets', '1.8.2'
gem 'execjs'#, '1.4.0'
gem 'therubyracer'#, '0.10.2', :require => 'v8'
gem 'momentjs-rails'
end
# javascript gems
gem 'jquery-rails', '2.1.4'
Any help would be greatly appreciated, thanks