2011-09-13 34 views
0

試圖從rails server切換到Apache和Passenger。我在日誌中找到了資產未找到的錯誤,並發現我需要執行rake assets:precompile。當我這樣做時(清潔後),我收到下面的消息。預編譯和rails server之間有什麼區別可能導致前者出現這樣的錯誤?如何獲得3.1 rails資產在mod_rails中工作?

$ 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 

回答

1

使用rails服務器,js文件將由webrick完成。

使用資產:預編譯它被連接並壓縮。爲了這個工作,它需要被解析,並且它有一個錯誤。同樣的錯誤在開發模式中也不會那麼糟糕,因爲它僅僅意味着JS加載在那一刻停止。如果您處於資產調試模式,它甚至只會影響特定文件。

我會查看編譯的應用程序JS在9398行,看看是否有語法錯誤,如果有去找它在源文件中。