Rails 5 Heroku deploy error: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace)

前端 未结 6 580
刺人心
刺人心 2021-01-07 23:01

When trying to deploy a rails 5 app to heroku, I get the following error, when it reaches Running: rake assets:precompile:

remote:        ExecJS         


        
6条回答
  •  感动是毒
    2021-01-07 23:35

    As the Uglifier official documentation says (https://github.com/lautis/uglifier):

    "The experimental ES6 syntax support can be enabled by passing :harmony => true option to Uglifier."

    Uglifier.compile(js, harmony: true)
    

    So replace in config/environments/production.rb.

    config.assets.js_compressor = :uglifier
    

    with

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

提交回复
热议问题