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:
- precompile the assets locally (rake assets:precompile). This created two files on the local system - think they were gz files).
- 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
How to Extract the Sign of an Integer in Ruby
Resetting a Singleton Instance in Ruby
What Is the Community-Preferred Ruby Unit Testing Framework
Rails/Rspec: How to Test #Initialize Method
<Rubygems> How to Change Gem Environment Settings
Rails: Switch Connection on Each Request But Keep a Connection Pool
How to Find Where a Ruby Method Is Declared
Rails Can't Login to Postgresql - Pg::Error - Password - Correct Info
How to Authorize a Google Service Account Without the Default Credentials File
Find Memory Leak in a Ruby on Rails Project
Using Ruby, Reading a File, Containing Name/Value Pairs into a Hash
Stylesheet_Link_Tag :All Versus :Media =>All
Adding Keywords to Ruby Syntax Highlighting for Notepad++
Active Admin Scopes for Each Instance of a Related Model