2012-11-03 72 views
3

我有一個Rails 3.2應用程序,twitter-boostrap-rails gem。運行rake資產:預編譯失敗,並顯示:資產預編譯失敗,twitter-bootstrap-rails gem

[email protected]:~/myapp$ rake assets:precompile 
/home/alex/.rvm/rubies/ruby-1.9.3-head/bin/ruby /home/alex/.rvm/gems/[email protected]/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets 
rake aborted! 
Invalid CSS after "...4882640c.png"")": expected "{", was ";background-pos..." 
    (in /home/alex/myapp/app/assets/stylesheets/application.css) 

Tasks: TOP => assets:precompile:primary 
(See full trace by running task with --trace) 
rake aborted! 
Command failed with status (1): [/home/alex/.rvm/rubies/ruby-1.9.3-head/bin...] 

有沒有什麼辦法可以調試這個問題?不知道該怎麼做。

更新:更新Twitter的引導護欄寶石2.1.6版本後,預編譯現在失敗,不同的錯誤:

rake aborted! 
Invalid CSS after "}​": expected "{", was "" 
    (in /home/alex/myapp/app/assets/stylesheets/application.css) 
(sass):1673 

在錯誤中提到的application.css是一個標準,與

*= require_self 
*= require_tree . 

..這使得有點難以確定哪個部分導致問題。

我可以以某種方式編譯bootstrap_and_overrides.less並查看出錯的地方嗎?

+3

我使用twitter-bootstrap-rails gem version 2.1.3解決了這個問題 - 在資產編譯生產好之後。 –

+0

謝謝,這也解決了我的問題。 – ericteubert

+0

您可以發佈自己的問題的答案並接受它 – mihai

回答

1

它似乎是在最新版本(2.1.6)中修復的。 把這個放在你的gemfile中應該會有效果。

gem 'twitter-bootstrap-rails' , '>= 2.1.6' 
+1

運行'''bundle update'''就足夠了。 –

+0

我仍然被Rake中止:「}」後出現無效CSS:預計「{」,was「」 –

+0

'gem list | grep twitter-bootstrap-rails'列出了已安裝gem的版本。您可以嘗試使用'gem uninstall twitter-bootstrap-rails -v 2.1。?'刪除它們,然後再次運行軟件包安裝。請注意,在這一點上,我只是猜測。當我從2.1.5切換到2.1.6時,這個錯誤消失了,當我切換回2.1.5時,這個錯誤消失了。 – Bigginn

相關問題