ionic/angular2-拒绝从'http://localhost:8100/build/main.css'应用样式,因为不支持其MIME类型('text/html') [英] ionic/angular2 - Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported

查看:293
本文介绍了ionic/angular2-拒绝从'http://localhost:8100/build/main.css'应用样式,因为不支持其MIME类型('text/html')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的离子模型运行良好,直到我想在iPhone上进行测试,所以我停止了服务器,然后执行了ionic serve --address localhost,然后我发现样式表不再加载...所以我再次杀死了服务器回到ionic serve并且错误仍然存​​在.

My ionic build was working perfectly up until I wanted to test on my iPhone so I stopped my server and then did a ionic serve --address localhost and I noticed that my stylesheet wasn't loading anymore... so I killed the server again went back to ionic serve and the error persisted..

(index):1拒绝应用来自' http://localhost:8100/build/main的样式.css ",因为它的MIME类型('text/html')不是受支持的样式表MIME类型,并且启用了严格的MIME检查.

(index):1 Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

我尝试清除localhost:8100上的缓存并重建项目,但错误仍然存​​在...

I've tried clearing the the cache on localhost:8100 and rebuilding the project but the error remains...

有什么想法吗?在解决之前,我几乎陷入困境:(

Any ideas? I'm pretty much stuck until this gets resolved :(

编辑:我最终解决它的方法可能不是最好的方法,但是至少可以再次使用.我刚进入我的github存储库,因为我的应用程序下载了main.css并将其粘贴到build文件夹中,此后我就没有问题了.

The way I ended up fixing it might not be the best.. but at least it works again. I just went into my github repository for my app downloaded the main.css and pasted it into the build folder and I've not had a problem since.

推荐答案

我遵循了在离子框架论坛上发布的这些说明.

I followed these instructions which were posted on ionic framework forum.

步骤: 使用ionic serve为您的项目提供服务,然后只需更改任何.ts文件并保存(ctrl+s),它将自动再次构建并为应用&错误将得到解决,希望:).

Steps: serve your project with ionic serve and then just change any .ts file and save it (ctrl+s) and it will automatically build again and serve the app & error will be resolved, hopefully :).

注意:您每次必须在初始离子发球时都要这样做

Note: you have to do this everytime on the initial ionic serve

查看完整答案 查看全文

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