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
How to Install Rmagick Gem on Windows
Instance_Eval's Block Argument(S)- Documented? Purpose
Callback for Active Storage File Upload
Mongodb Group Using Ruby Driver
How to Mock an Instance Method of an Already Mocked Object
How to Add Conditional Rubygem Requirements to a Gem Specification
Simple Remote Odbc Database Connection with Ruby
How to Figure Out Which Step I'Ve Just Executed in Cucumber's Afterstep Hook
What Could Be Causing This Rails Ioerror Closed Stream
Cucumber Step Definition for "Given That I'm Logged In"
Rails Not Rolling Back Transaction After Failed Save()
Using Ruby, What Is the Most Efficient Way to Get the Content Type of a Given Url