Deploying an Angular 8 Project to Github Pages with ngh

2.2k Views Asked by At

I'm running this on my angular 8 project:

    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

I get the index.html could not be copied and it looks like it's because Angular generates the build files to dist/PROJECT_NAME and in this case the project name is test.

I looks like ngh is expecting to find index.html in dist instead of in dist/test.

Any ideas on how to work around this?

This is the reference I was going by.

1

There are 1 best solutions below

0
Ole On

I changed the angular.json outputPath to dist and now it works:

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