ExecJS::ProgramError: 运行 rake 资产时出现意外的标记 punc «(»,预期的 punc «:»:在生产中预编译 [英] ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» when running rake assets:precompile on production
问题描述
在部署我的 Rails 应用程序时出现以下错误:
rake 中止!ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» (line: 15, col: 14, pos: 265)错误在新的 JS_Parse_Error (/tmp/execjs20150524-4411-1p45n63js:2359:10623)在 js_error (/tmp/execjs20150524-4411-1p45n63js:2359:10842)在 croak (/tmp/execjs20150524-4411-1p45n63js:2359:19086)在 token_error (/tmp/execjs20150524-4411-1p45n63js:2359:19223)在expect_token (/tmp/execjs20150524-4411-1p45n63js:2359:19446)在期望 (/tmp/execjs20150524-4411-1p45n63js:2359:19584)在/tmp/execjs20150524-4411-1p45n63js:2359:28513在/tmp/execjs20150524-4411-1p45n63js:2359:19957在 expr_atom (/tmp/execjs20150524-4411-1p45n63js:2359:27269)在maybe_unary (/tmp/execjs20150524-4411-1p45n63js:2359:30019)new JS_Parse_Error ((execjs):2359:10623)js_error ((execjs):2359:10842)呱呱 ((execjs):2359:19086)token_error ((execjs):2359:19223)expect_token ((execjs):2359:19446)期望((execjs):2359:19584)(execjs):2359:28513(execjs):2359:19957expr_atom ((execjs):2359:27269)may_unary ((execjs):2359:30019)
有问题的文件是有效的,它在本地主机上工作.我还尝试在本地主机上运行 rake assests:precompile
,一切都通过了.最后,我尝试从文件中删除内容, git push 并重新部署 - 仍然遇到相同的错误.只有完全删除文件并重新部署才有帮助.
希望有任何想法.
一个>
运行 rails 控制台并:
JS_PATH = "app/assets/javascripts/**/*.js";Dir[JS_PATH].each do |file_name|puts "
#{file_name}"puts Uglifier.compile(File.read(file_name),harmony: true)结尾
它将显示文件和 Uglifier 导致问题的行.
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)
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.
Would appreciate any ideas.
Here I found help for the same problem you had.
Run rails console and:
JS_PATH = "app/assets/javascripts/**/*.js";
Dir[JS_PATH].each do |file_name|
puts "
#{file_name}"
puts Uglifier.compile(File.read(file_name), harmony: true)
end
It will show you the file and the line where the Uglifier is making the problem.
这篇关于ExecJS::ProgramError: 运行 rake 资产时出现意外的标记 punc «(»,预期的 punc «:»:在生产中预编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!