【问题标题】:Disallowed MIME type (“text/html”) error - Angular Github pages不允许的 MIME 类型(“text/html”)错误 - Angular Github 页面
【发布时间】:2020-03-21 16:00:28
【问题描述】:

我刚刚将一个 Angular 8 项目部署到我的 Github 存储库,但 Github 页面上没有显示任何内容,但我在浏览器控制台上看到一个错误。

在 Firefox 上,错误提示:

Loading module from “https://theotherspace.illiteratibooksandcoffee.com/theotherspace/runtime-es2015.27965c48d77c449cb93c.js” was blocked because of a disallowed MIME type (“text/html”).

在 Chrome 上:

Failed to load resource: the server responded with a status of 404 ()

以下是截图:

【问题讨论】:

  • 我在控制台中看不到任何问题或错误。问题解决了吗?如果没有 - 尝试清理浏览器缓存:)
  • 我仍然看到错误,因此它甚至不会呈现页面。
  • 我尝试了github.com/angular/angular/issues/30835 中提到的一些解决方案,但没有成功。看看它是否对您的项目有帮助。

标签: angular github github-pages


【解决方案1】:

我在使用来自不同存储库(而不是父 github.io 存储库)的 Github 页面时遇到了类似的问题。

通过将base href 更改为当前目录解决了这个问题。

之前

<base href="/">

改成

<base href="./">

我参考了https://github.com/angular/angular/issues/30835,直到我找到了这个解决方案。

【讨论】:

    猜你喜欢
    • 2018-12-13
    • 2020-02-14
    • 2020-01-30
    • 1970-01-01
    • 2020-05-11
    • 2020-08-06
    • 2021-04-07
    • 2018-09-09
    相关资源
    最近更新 更多