Rails 3.1 Asset Pipeline和Uglifier中的可能错误 [英] Rails 3.1 Possible Bug in Asset Pipeline and Uglifier

查看:78
本文介绍了Rails 3.1 Asset Pipeline和Uglifier中的可能错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在raoku任务中失败时,在Heroku上部署时遇到了问题

I ran into a problem deploying on Heroku do to a failure in the rake task

rake assets:precompile

最下面是集成后出现的错误

At the bottom is the error I get if I integrate

错误发生在uglifier中.

The error happens from uglifier.

我怀疑问题可能与日历的许多本地化有关.

I suspect that problem could be related to the inclusion of many localizations for the calendar.

我通过设置以下方法来解决该错误:

I worked around the error by setting:

# Compress JavaScripts and CSS
config.assets.compress = false

由于临时文件被清除,我无法检查文件.我也无法让RubyMine中的调试器在断点处停止.

I was not able to examine the files as the temporary files are cleaned up. I also could not get the debugger in RubyMine to stop at a breakpoint.

任何想法,如果这是一个错误?有什么办法可以使临时文件不被删除?使RubyMine调试器完成rake任务的任何方法(是的,尝试使用EAP 112-291进行显而易见的操作.

Any ideas if this is a bug? Any way to get the temporary files to not get deleted? Any way to make the RubyMine debugger work on the rake task (yes, tried the obvious, using EAP 112-291.

rake资产:预编译:所有RAILS_ENV =生产RAILS_GROUPS =资产 耙子流产了!意外的字符''(行:21454,行:0,位置: 641761)

rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets rake aborted! Unexpected character '' (line: 21454, col: 0, pos: 641761)

错误 在新的JS_Parse_Error(/tmp/execjs20111231-15374-1fve7h4.js:497:22) 在js_error(/tmp/execjs20111231-15374-1fve7h4.js:505:15) 在parse_error(/tmp/execjs20111231-15374-1fve7h4.js:596:17) 在Object.next_token [作为输入](/tmp/execjs20111231-15374-1fve7h4.js:839:17) 在下一个(/tmp/execjs20111231-15374-1fve7h4.js:943:37) at Object.semicolon [as 1](/tmp/execjs20111231-15374-1fve7h4.js:986:38) 在prog1(/tmp/execjs20111231-15374-1fve7h4.js:1527:28) 在simple_statement(/tmp/execjs20111231-15374-1fve7h4.js:1123:35) 在/tmp/execjs20111231-15374-1fve7h4.js:1031:35 在/tmp/execjs20111231-15374-1fve7h4.js:1510:32

Error at new JS_Parse_Error (/tmp/execjs20111231-15374-1fve7h4.js:497:22) at js_error (/tmp/execjs20111231-15374-1fve7h4.js:505:15) at parse_error (/tmp/execjs20111231-15374-1fve7h4.js:596:17) at Object.next_token [as input] (/tmp/execjs20111231-15374-1fve7h4.js:839:17) at next (/tmp/execjs20111231-15374-1fve7h4.js:943:37) at Object.semicolon [as 1] (/tmp/execjs20111231-15374-1fve7h4.js:986:38) at prog1 (/tmp/execjs20111231-15374-1fve7h4.js:1527:28) at simple_statement (/tmp/execjs20111231-15374-1fve7h4.js:1123:35) at /tmp/execjs20111231-15374-1fve7h4.js:1031:35 at /tmp/execjs20111231-15374-1fve7h4.js:1510:32

推荐答案

您可能会发现其中一个js文件在某处存在语法错误.这可能是块末尾缺少分号或其他一些小问题.通常,浏览器仍会加载js并且可以正常运行,但是uglifier无法将这些错误压缩.我将首先开始查找本地化文件.

You will probably find that one of you js files has a syntax error somewhere. This could be a missing semicolon at the end of a block, or some other minor problem. Often browsers will still load the js and it will work, but uglifier cannot compress it with those errors. I would start looking in the localisation files first.

找出哪个文件包含错误的一种方法是使用最少的文件在本地重新编译,然后逐个添加直到损坏.如果是由于缺少分号引起的,则破损将是您添加的倒数第二个文件.

One way to find out which file contains the error is to re precompile locally with a minimal set of files and add things one by one until it breaks. If it is due to a missing semicolon, the breakage will the second-last file you added.

这篇关于Rails 3.1 Asset Pipeline和Uglifier中的可能错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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