【问题标题】:Deploying an Angular 8 Project to Github Pages with ngh使用 ngh 将 Angular 8 项目部署到 Github Pages
【发布时间】:2019-11-02 03:56:49
【问题描述】:

我在我的 angular 8 项目上运行它:

    ole@mkt:~/test$ ngh
    index.html could not be copied to 404.html. This does not look like an angular-cli project?!
    (Hint: are you sure that you have setup the directory correctly?)
    Diagnostic info [Error: ENOENT: no such file or directory, stat '/home/ole/test/dist/index.html'] {
    errno: -2,
    code: 'ENOENT',
    syscall: 'stat',
    path: '/home/ole/test/dist/index.html'
    }
    ???? Successfully published via angular-cli-ghpages! Have a nice day!
    ole@mkt:~/test$ ls dist/
    test

我得到 index.html 无法复制,看起来这是因为 Angular 将构建文件生成到 dist/PROJECT_NAME,在这种情况下,项目名称是 test

我看起来 ngh 希望在 dist 中找到 index.html,而不是在 dist/test 中。

关于如何解决这个问题的任何想法?

This is the reference I was going by.

【问题讨论】:

    标签: node.js angular typescript github-pages angular-cli-ghpages


    【解决方案1】:

    我将angular.json outputPath 更改为dist,现在它可以工作了:

      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/",
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-18
      • 2017-11-27
      • 1970-01-01
      • 1970-01-01
      • 2020-02-22
      • 2020-09-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多