ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» when running rake assets:precompile on production

后端 未结 10 1402
小鲜肉
小鲜肉 2020-11-28 20:08

When deploying my Rails app I get the following error:

rake aborted!
   ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» (line: 15, col: 14         


        
10条回答
  •  孤城傲影
    2020-11-28 21:00

    December/2019 answer: starting on version 4.2.0 (released in Sept/2019), Uglifier now shows a beautiful (colored!) debug output showing you the offending line of code.

    I was having a Uglifier::Error: Unexpected character ''` error and I couldn't find it even following all the other solutions in this page.

    So go to your Gemfile, and set your Uglifier to be at least 4.2:

    # Use Uglifier as compressor for JavaScript assets
    gem 'uglifier', '>= 4.2'
    

    Run bundle update uglifier to update it.

    And then just look at the output, it will show you something like this:

提交回复
热议问题