ExecJS :: ProgramError:意外的令牌punc«(»,expected punc«:»运行rake资产时:预编译生产 [英] ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» when running rake assets:precompile on production

查看:342
本文介绍了ExecJS :: ProgramError:意外的令牌punc«(»,expected punc«:»运行rake资产时:预编译生产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当部署我的Rails应用程序时,我收到以下错误:

When deploying my Rails app I get the following error:

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

   Error
   at new JS_Parse_Error (/tmp/execjs20150524-4411-1p45n63js:2359:10623)
   at js_error (/tmp/execjs20150524-4411-1p45n63js:2359:10842)
   at croak (/tmp/execjs20150524-4411-1p45n63js:2359:19086)
   at token_error (/tmp/execjs20150524-4411-1p45n63js:2359:19223)
   at expect_token (/tmp/execjs20150524-4411-1p45n63js:2359:19446)
   at expect (/tmp/execjs20150524-4411-1p45n63js:2359:19584)
   at /tmp/execjs20150524-4411-1p45n63js:2359:28513
   at /tmp/execjs20150524-4411-1p45n63js:2359:19957
   at expr_atom (/tmp/execjs20150524-4411-1p45n63js:2359:27269)
   at maybe_unary (/tmp/execjs20150524-4411-1p45n63js:2359:30019)new JS_Parse_Error ((execjs):2359:10623)
   js_error ((execjs):2359:10842)
   croak ((execjs):2359:19086)
   token_error ((execjs):2359:19223)
   expect_token ((execjs):2359:19446)
   expect ((execjs):2359:19584)
   (execjs):2359:28513
   (execjs):2359:19957
   expr_atom ((execjs):2359:27269)
   maybe_unary ((execjs):2359:30019)

有效,它在本地主机上工作。我也尝试在localhost上运行 rake assests:precompile ,它全部通过。最后,我试图从文件中删除内容,git push和重新部署 - 仍然有相同的错误。只有完全删除文件并重新部署才有帮助。

The file in question is valid, it works on localhost. I also tried running rake assests:precompile on localhost, it all passes. Finally, I tried to remove the content from the file, git push and redeploy - still got the same error. Only completely removing the file and re-deploying helps.

感谢任何想法。

推荐答案

在这里,我找到了与您有同样问题的帮助。

运行rails控制台和:

Run rails console and:

JS_PATH = "app/assets/javascripts/**/*.js"; 
Dir[JS_PATH].each do |file_name|
  puts "\n#{file_name}"
  puts Uglifier.compile(File.read(file_name))
end

它将显示Uglifier发生问题的文件和行。

It will show you the file and the line where the Uglifier is making the problem.

这篇关于ExecJS :: ProgramError:意外的令牌punc«(»,expected punc«:»运行rake资产时:预编译生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆