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

后端 未结 10 1400
小鲜肉
小鲜肉 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 20:54

    I'm not sure of your build chain, but I got here by pasting the same error message into Google.

    That is called 'shorthand properties' in ES2015. I'm using Babel 6 with Gulp and needed to do an npm install babel-plugin-transform-es2015-shorthand-properties --save-dev and add that transform to my babel plugins.

    .pipe(babel({
        plugins: [
            'transform-es2015-shorthand-properties'
        ]
    }))
    

    https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-shorthand-properties

提交回复
热议问题