Skip to content Skip to sidebar Skip to footer

Syntax Error When Deploying Rails App To Heroku: ExecJS::RuntimeError: SyntaxError: Unexpected Character

I am trying to deploy my app to Heroku but its throwing me this error. 'ExecJS::RuntimeError: SyntaxError: Unexpected character '`' (line: 14577, col: 33, pos: 440811' I assume

Solution 1:

The problem, as some of the users has mentioned, is Rails JS uglifier not being able to handle ES6 template literals.

Uglifier now has a Harmony mode which supports ES6 / ES2015+ syntax.

You can enable it by passing :harmony => true option to Uglifier.

Open config/environments/production.rb

Replace

config.assets.js_compressor = :uglifier

with

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

Solution 2:

I'm facing a similar error, it seems like Rails JS uglifier can't handle ES6 template literals. You might need to replace "`" (template literals) with single or double quotes. In case you want to verify, copy paste your problematic JS (you'll have to search for "`" in your JS directory) file here https://jscompress.com/ and see the error.


Post a Comment for "Syntax Error When Deploying Rails App To Heroku: ExecJS::RuntimeError: SyntaxError: Unexpected Character"