2

我已在 GitHub 页面上成功发布了我的应用程序,但我的网站没有显示任何内容。

这是我的 GitHub 存储库链接:https ://github.com/chirag299051/Ice-and-Fire

我在控制台中遇到的错误:

inline.318b50c57b4eba3d437b.bundle.js Failed to load resource: the server responded with a status of 404 ()
polyfills.b6b2cd0d4c472ac3ac12.bundle.js Failed to load resource: the server responded with a status of 404 ()
scripts.e2cc764d74d6cb8d1c42.bundle.js Failed to load resource: the server responded with a status of 404 ()
main.54e8c9147109b23af744.bundle.js Failed to load resource: the server responded with a status of 404 ()
styles.a9b0b1037568d3083749.bundle.css Failed to load resource: the server responded with a status of 404 ()
polyfills.b6b2cd0d4c472ac3ac12.bundle.js Failed to load resource: the server responded with a status of 404 ()
scripts.e2cc764d74d6cb8d1c42.bundle.js Failed to load resource: the server responded with a status of 404 ()
main.54e8c9147109b23af744.bundle.js Failed to load resource: the server responded with a status of 404 ()
styles.a9b0b1037568d3083749.bundle.css Failed to load resource: the server responded with a status of 404 ()
4

1 回答 1

7

您的脚本驻留在https://chirag299051.github.io/Ice-and-Fire其中,而您的应用程序正试图从https://chirag299051.github.io/.

使您可以从https://chirag299051.github.io/Ice-and-Fire.

例如, https://chirag299051.github.io/main.54e8c9147109b23af744.bundle.js应该是https://chirag299051.github.io/Ice-and-Fire/main.54e8c9147109b23af744.bundle.js

您可以通过使用--base-href标志构建项目并在 中设置<base href>标签来设置这些路径,有关更多信息index.html请参阅文档。

在您的情况下,这会导致

ng build --base-href=/Ice-and-Fire/

和一个index.html看起来像这样的

<html>
  <head>
    <base href="/Ice-and-Fire/">
    ...
  </head>
  <body>...</body>

</html>
于 2018-04-30T20:22:38.410 回答