Rails 5 Heroku Deploy Error: Execjs::Programerror: Syntaxerror: Unexpected Token: Name (Autoregisternamespace)

Rails 5 Heroku deploy error: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace)

It may have something to do with javascript/coffescript syntax. Check if you have let, it shout be replaced with var.

Edit - see @Guilherme Lages Santos's response. Uglifier added ES6 support since version 3.2.0 so you can just use it like this in your environment file

config.assets.js_compressor = Uglifier.new(harmony: true)

ExecJS::RuntimeError: SyntaxError: Unexpected token: name (catch) (line: 41, col: 8, pos: 1392)

Syntax error with two dots. The line break sometimes makes it hard to notice.

 event.respondWith(
fetch(request). // Dot here and then...
.catch(function fallback() { // ... the one at beginning of line as well causes the issue...
caches.match(request).then(function(response) { // then, the cache
response || caches.match("/offline.html.erb"); // then, /offline cache
})
})
);

Should be

 event.respondWith(
fetch(request) // remove dot
.catch(function fallback() {
caches.match(request).then(function(response) { // then, the cache
response || caches.match("/offline.html.erb"); // then, /offline cache
})
})
);

ExecJS::ProgramError: SyntaxError: Unexpected token: name ClassName

I'd written the JavaScript in ES6 and rails 3 shows error while ES6 code. All the methods of using ES6 in rails is not for rails 3. So I converted ES6 to ES5 code.

ExecJS::ProgramError: SyntaxError: Unexpected token: name ClassName

I'd written the JavaScript in ES6 and rails 3 shows error while ES6 code. All the methods of using ES6 in rails is not for rails 3. So I converted ES6 to ES5 code.



Related Topics



Leave a reply



Submit