Rails 3.1 Possible error in the pipeline and Uglifier

I'm having a problem deploying on Heroku do crash rake

rake assets:precompile 

At the bottom there is an error that I get if I integrate

The error comes from uglifier.

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

I worked on the error by setting:

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

I was unable to verify the files as temporary files were deleted. I also could not get the debugger in RubyMine to stop at a breakpoint.

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

rake assets: precompile: all RAILS_ENV = production RAILS_GROUPS = rake assets are interrupted! Unexpected character '' (line: 21454, col: 0, pos: 641 761)

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

+4
source share
4 answers

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 the block, or some other minor issue. Often browsers will still load js and it will work, but uglifier cannot compress these errors. First, I will start looking for localization files.

One way to find out which file contains the error is to recompile locally with a minimal set of files and add things one by one until it breaks. If this is due to a missing semicolon, then a break will be added to the second last file.

+6
source

Mine precompiled after I deleted the wandering "debugger" operator. Woops.

+3
source

If anyone reads this stream, is faced with problems with Unicode characters or the "invalid byte sequence in UTF-8" in your rails application, try putting it in the production.rb file:

 # override default uglifier options so we don't mangle unicode config.assets.js_compressor = Uglifier.new(output: {ascii_only: true}) 

In my case, the uglifier converted strings in my javascript like \udbff to UTF-8 í¯¿ that eventually break some unicode regular expression. (This happened with turbo asterisks and codemirror, but you may encounter it at any time when your javascript relies on ASCII representations of Unicode characters.)

+2
source

The I18N file "jquery-ui-i18n.js" has a bad character before each comment.

Looking at the first two lines with “more” in the shell, the wrong character is displayed:

 <U+FEFF>/* Afrikaans initialisation for the jQuery UI date picker plugin. */ /* Written by Renier Pretorius. */ 

After deleting this character, it works.

0
source

Source: https://habr.com/ru/post/1388793/


All Articles