2013-10-30 96 views
4

Heroku的突然停止工作,並給了我這個錯誤:Heroku的CSS不加載:預編譯

could not connect to server: Connection refused 
    Is the server running on host "127.0.0.1" and accepting 
    Precompiling assets failed. 

經過一番研究,我跑這條線:

running RAILS_ENV=production bundle exec rake assets:precompile 

這個工作,但現在當我推對heroku的更新新的CSS不加載。 該行從未使用過,然後才能展示:

Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment 

如果可能的話,你可以也解釋了爲什麼資產:預編譯線解決了我原來的問題?

+0

閱讀:http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets這將回答您的問題原因,爲什麼你應該預編譯你的資產。但是這個特定的命令使用'exec'命令在生產模式下運行它。另外,當你說新的CSS不會更新你所得到的控制檯中的錯誤。發佈這個 – David

+0

感謝您的鏈接,這有助於我更多地理解它。推送到heroku沒有錯誤,只是沒有加載任何新的CSS。 – user2759575

+0

在嘗試加載頁面的時候,打開firebug或chrome開發工具並轉到控制檯。你應該有一些輸出 – David

回答

10

運行此命令:

bundle exec rake tmp:clear 

bundle exec rake assets:clean RAILS_ENV=production 

bundle exec rake assets:precompile RAILS_ENV=production 

希望這有助於!

+1

它只需要bundle exec rake assets:clean RAILS_ENV =生產就可以工作。謝謝您的幫助! – user2759575