簡體   English   中英

Rails Bower無法編譯

[英]Rails bower doesn't compile

我有使用Bower來管理前端庫的rails解決方案。 我按照本教程進行了設置。 它正在工作,但是當我嘗試對其進行預編譯時,它會因以下錯誤而崩潰:

RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
ExecJS::ProgramError: Unexpected token: eof (undefined) (line: 46, col: 0, pos: 1406)

Error
    at new JS_Parse_Error (/tmp/execjs20140911-20410-llghcjjs:2357:10623)
    at js_error (/tmp/execjs20140911-20410-llghcjjs:2357:10842)
    at croak (/tmp/execjs20140911-20410-llghcjjs:2357:19067)
    at token_error (/tmp/execjs20140911-20410-llghcjjs:2357:19204)
    at unexpected (/tmp/execjs20140911-20410-llghcjjs:2357:19292)
    at block_ (/tmp/execjs20140911-20410-llghcjjs:2357:24537)
    at ctor.body (/tmp/execjs20140911-20410-llghcjjs:2357:24191)
    at function_ (/tmp/execjs20140911-20410-llghcjjs:2357:24256)
    at expr_atom (/tmp/execjs20140911-20410-llghcjjs:2357:27308)
    at maybe_unary (/tmp/execjs20140911-20410-llghcjjs:2357:29977)
  (in /home/augustopedraza/Documents/Projects/BuscoHogar/landing-page/vendor/assets/bower_components/jquery/src/intro.js)

知道如何解決嗎?

提前致謝!!!

我有同樣的問題..我發現這是由於資產的總體壓縮..因此,一個臨時修復程序將在config / environments / production.rb中注釋此行:

config.assets.js_compressor = :uglifier

我目前不知道uglifier本身在壓縮JS文件后是否會導致錯誤,或者JS是否有問題。 我目前正在探索js壓縮的其他替代方案,以查看它是否可以正常工作。.PS我也在使用Bower組件,因此也許bower + uglifier會導致錯誤

我可以通過編輯文件intro.js來解決此問題。產生錯誤的行是:

 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ){

更改為

}(typeof window !== "undefined" ? window : this, function( window, noGlobal ){}));

您現在可能會得到outro.js的錯誤,該錯誤僅包含缺少的內容

}));

只要刪除它,一切都應該編譯。 我還沒有對其進行廣泛的測試,但是由於這些更改,我沒有注意到jquery有任何問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM