Last Updated: November 16, 2016
·
2.847K
· Jonalogy

Heroku rails upload error: ExecJS::RuntimeError: SyntaxError: Unexpected token punc «}»

Heroku showed the following mentioned error and it was impossible to tell where the error is on local files:

remote: ExecJS::RuntimeError: SyntaxError: Unexpected token punc «}», expected punc «:» (line: 12237, col: 35, pos: 371179)

Found help on stackoverflow: http://stackoverflow.com/questions/30422437/execjsprogramerror-unexpected-token-punc-expected-punc-when-running

Run the following code on local rails console and it will show where the problem lies locally:
JS_PATH = "app/assets/javascripts/**/*.js"; Dir[JS_PATH].each do |file_name| puts "\n#{file_name}" puts Uglifier.compile(File.read(file_name)) end

result:
app/assets/javascripts/dashboards.js ExecJS::RuntimeError: SyntaxError: Unexpected token punc «}», expected punc «:» (line: 63, col: 35, pos: 2791)
~~