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

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

    As the backtrace doesn't provide information about the corrupted file, for me the best way to identify the error is use git bisect.

    It allows you to find the commit that introduces a bug.

    Let's suppose you are on master, first you start git bisect:

    $ git bisect start
    $ git bisect bad 
    

    Then you go back to a previous, working revision, let's suppose 20 revision ago.

    $ git checkout HEAD~20
    

    You run the same command

    $ RAILS_ENV=production rake assets:precompile
    

    If it works you mark revision as good:

    $ git bisect good.
    

    git will jump to another revision, you run same command again (assets:precompile) and bassed on the output mark it as good / bad.

    In less than 1 minute you should be able to find what's the commit that introduced the issue.

提交回复
热议问题