代码之家  ›  专栏  ›  技术社区  ›  Strongprogrammee

在github企业页面上发布angular应用程序不起作用

  •  1
  • Strongprogrammee  · 技术社区  · 3 年前

    我最近开发了一个简单的angular应用程序,并决定在企业github页面上发布。我使用了以下方法:

    cd App
    npm install
    ng build --prod
    cd ../app-github-pages-repo
    cp -R ../App/dist/app/* .
    git commit -m "Added the app"
    git push
    

    在github设置中,我看到了这条消息

    Your site is published at https://host/pages/orgname/
    

    但当我试图访问它时,it资源并没有被下载,页面也不会出现

    1 回复  |  直到 3 年前
        1
  •  2
  •   deepakchethan    3 年前

    你没有为你的应用设置base href。这是必要的,因为你的应用程序不是托管在域的根目录下。

    您可以尝试按如下方式构建应用程序:

    ng build --prod --base-href https://host/pages/orgname/
    

    确保base href实际指向源的根所在位置,并遵循其余步骤。