2016-02-23 51 views
3

我試圖在生產模式下運行的軌道(不很瞭解)使用下面的命令:在生產模式下運行軌道本地

rails server -e production 

但我正在逐漸控制檯這些錯誤和一個醜陋的頁面,而不該css正在加載:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://10.20.200.199:3000/". 
(index):1 Refused to execute script from 'http://10.20.200.199:3000/javascripts/application.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. 
(index):1 Refused to execute script from 'http://10.20.200.199:3000/logins/plugins.js?v=1' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. 

這發生在我們正在使用的所有腳本中。

有人可以幫助我在這裏可能會出錯。

在此先感謝。

回答

4

對於生產環境中運行預生成資產產生:rake assets:precompile

所描述的錯誤提示,瀏覽器請求靜態資產;這些不是自建的(它們不是在生產環境中自動構建的 - 您需要在每次部署時構建它們),因此在它們的URL上找不到任何內容,而是渲染錯誤頁面。因此,瀏覽器錯誤表示下載的CSS和JavaScript文件具有面向MIME類型。

相關問題