加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 在本地生产模式下运行导轨

发布时间:2020-12-17 03:10:21 所属栏目:百科 来源:网络整理
导读:我正在尝试使用以下命令在生产模式下运行rails(不太了解它): rails server -e production 但是我在控制台和丑陋的页面中收到这些错误而没有加载css: Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://10.20.200.199
我正在尝试使用以下命令在生产模式下运行rails(不太了解它):

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.

这种情况发生在我们正在使用的所有脚本中.

有人可以帮我解决这里可能出错的问题.

提前致谢.

解决方法

对于使用生产环境预运行的组件运行:rake assets:precompile

描述的错误表明浏览器请求静态资产;这些都没有构建(它们不是在生产中自动构建的 – 您需要在每次部署时构建它们),因此在其URL上找不到任何内容,而是呈现错误页面.因此浏览器错误说下载的css和javascript文件具有wront MIME类型.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读