Precompiling Assets Failed Execjs::Programerror: Unexpected Token: Operator (=) (Line: 10770 , Col: 0, Pos: 300859)

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
})
})
);

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 Unexpected token: operator ( ) in vue.js method

Well, for those who'll have the same issue, this is were my problem was, it should be .then(function(response) { instead of .then((response) => {

  fetchStates: function () {
this.$http.get('/api/locations/all_states').then(function(response) {
states = $.parseJSON(response.responseText).states
paymentInfo.$set('states', states)
}).then(function() {
$('.cs-select').trigger('chosen:updated')
})
},

Deploying to Heroku: ExecJS::RuntimeError: SyntaxError: Unexpected token

What ended up solving this problem for me (this time, at least), was to:

  1. precompile the assets locally (rake assets:precompile). This created two files on the local system - think they were gz files).
  2. Commit and push to Heroku. It worked after this.

Although, this explains nothing to me. I have never needed to precompile assets before. And, if it was necessary to do, why did the localhost always work without executing this command? And, Heroku always attempts to precompile the assets. Why did it succeed when I pushed, supposedly, pre-precompiled assets? Doesn't it redo the precompilation anyway?

So, for now, the problem is solved. I have no idea why.



Related Topics



Leave a reply



Submit