部署我的Rails应用程序时,我收到以下错误:
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:在localhost上预编译,它全部通过.最后,我试图从文件中删除内容,git push和redeploy – 仍然得到相同的错误.只有完全删除文件并重新部署帮助.
会欣赏任何想法.
解决方法:
Here I found help for the same problem you had.
运行rails console和:
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出现问题的行.