简体   繁体   中英

How to get 3.1 rails assets working in mod_rails?

Trying to switch from rails server to Apache and Passenger. I got an asset-not-found error in the logs, and found out I needed to do rake assets:precompile . When I do so (after cleaning), I get the below message. What are the differences between precompiling and rails server that could create such an error in the former?

$ rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
Unexpected token: operator (>) (line: 9398, col: 3, pos: 252073)

TypeError: object is not a function
    at Object.CALL_NON_FUNCTION (native)
    at new JS_Parse_Error (/tmp/execjs20110913-10691-16kuf4b.js:463:20)
    at js_error (/tmp/execjs20110913-10691-16kuf4b.js:474:15)
    at croak (/tmp/execjs20110913-10691-16kuf4b.js:926:49)
    at token_error (/tmp/execjs20110913-10691-16kuf4b.js:930:45)
    at unexpected (/tmp/execjs20110913-10691-16kuf4b.js:936:84)
    at /tmp/execjs20110913-10691-16kuf4b.js:1304:17
    at maybe_unary (/tmp/execjs20110913-10691-16kuf4b.js:1389:27)
    at expr_op (/tmp/execjs20110913-10691-16kuf4b.js:1409:45)
    at expr_ops (/tmp/execjs20110913-10691-16kuf4b.js:1416:24)
  (in /home/user/locator/app/assets/javascripts/application.js)

Tasks: TOP => assets:precompile

With rails server the js file will simply be served by webrick.

With assets:precompile it is concatenated and compressed. For this to work it needs to be parsed and it has an error in it. The same error is not as bad in development mode because it simply means that JS loading is stopped at that point. If you are in asset debug mode it even affects the specific file only.

I would look in the compiled application JS at line 9398 and look if there is a syntax error and if there is go find it in the source file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM