Node.Js:资源解释为字体,但使用MIME类型text/html传输 [英] Node.Js: Resource Interpreted as Font but Transferred with MIME Type text/html

查看:177
本文介绍了Node.Js:资源解释为字体,但使用MIME类型text/html传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由Node.Js提供服务的我网站上的图标未呈现,并且我看到标题中指示的错误.我正在为服务器使用此脚本... https://github.com/joeeames/AngularFundamentalsFiles/blob/master/web-server.js

The icons on my website, which is being served up by Node.Js, are not rendering, and I am seeing the error indicated in the title. I am using this script for my server... https://github.com/joeeames/AngularFundamentalsFiles/blob/master/web-server.js

第98行下面我添加了...

'woff':'application/font-woff'

我也是...

npm install mime

但是我似乎什么都没做.有谁知道如何解决这个问题?控制台中的特定错误是...

But nothing I do seems to work. Does anyone know how how to solve this problem? The specific error from the console is...

Resource interpreted as Font but transferred with MIME type text/html: "https://<my_site>/bower_components/font-awesome/fonts/fontawesome-webfont.woff?v=4.1.0".

我在TTF和SVG类型上看到类似的错误.

I see similar errors for TTF and SVG types.

推荐答案

这可能意味着您正在请求的资源没有匹配的路由,因此服务器正在向下发送索引页面.如果在浏览器的开发人员工具中查看请求的内容,则应该看到它是一个正在返回的html文档.您需要诊断为什么要请求的内容除了提供index.html页的默认路由之外没有匹配的路由.

It probably means that you are requesting a resource that doesn't have a matching route, so the server is sending down the index page. If you look at the contents of the request in the developer tools of your browser, you should see that it is an html document that is being returned. You need to diagnose why what you are requesting doesn't have a matching route besides the default route that serves up the index.html page.

这篇关于Node.Js:资源解释为字体,但使用MIME类型text/html传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆