我在将Angular应用程序部署到github页面时遇到问题

时间:2019-08-17 19:35:31

标签: angular github

该网站在Firefox中运行良好,但是在chrome中查看时,我收到以下错误消息

styles.7c3fd40….css:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED
runtime.2620947….js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED
polyfills.bebee6a….js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED
main.700130d….js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED
%3Cultan-kearns%3E.g…earns/favicon.ico:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

很抱歉,如果这是一个愚蠢的问题,我还没有使用Angular的github页面。

有问题的网站是:https://ultan-kearns.github.io/ultankearns/

我尝试在Opera和Edge中运行该站点,但遇到相同的错误,并且我尝试多次重新部署该站点,但我还是遇到了麻烦。谢谢大家。

2 个答案:

答案 0 :(得分:2)

请检查base href文件中的index.html

<base href="https://<ultan-kearns>.github.io/ultankearns/">

应该是这个:

<base href="https://ultan-kearns.github.io/ultankearns/">

此代码块应位于您的head标签内,

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Oswald&display=swap" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>

您的html文件向外看,应设置格式/外观如下:

<!doctype html>
    <head>
        <meta charset="utf-8">
        <title>Website</title>
        <base href="https://ultan-kearns.github.io/ultankearns/">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="icon" type="image/x-icon" href="favicon.ico">
        <link rel="stylesheet" href="styles.7c3fd40d0bab5f41ea0e.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
        <link href="https://fonts.googleapis.com/css?family=Oswald&display=swap" rel="stylesheet">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
    </head>
    <body>
        <app-root></app-root>
        <script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script>
        <script type="text/javascript" src="polyfills.bebee6a5ef0ece001bc6.js"></script>
        <script type="text/javascript" src="main.700130d31064f7530e56.js"></script>
    </body>
</html>
  

请将此与您的index.html进行比较,并用您的{   并将其上传到gitgub即可。

答案 1 :(得分:1)

结果是我的文件现在一切正常,但出错了,我的index.html中有一些本不应该存在的文件。