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

后端 未结 10 1419
小鲜肉
小鲜肉 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:33

    I suspect, in that js file, you have something like the following:

    var User = {
        getName() {
            alert("my name");
        }
    }
    

    Replacing it with the right format,

    var User = {
        getName: function() {
            alert("my name");
        }
    }
    

    worked for me.

    Error is clearly saying, it's expecting ":" but it found "(".

提交回复
热议问题