Error deploying Angular4 to ghpages using angular-cli-ghpages

I solved this by added the following to the end of the scripts object in package.json,

"scripts": {

   "deploy": "ng build --prod --base-href 
   https://shanegibney.github.io/mathapp/ && angular-cli-ghpages --branch 
   gh-pages"
}

and then ran,

$sudo npm run deploy

So it seems that what was needed was the '--branch gh-pages' as an option, but there is nothing to suggest this on the npm page for angular-cli-ghpages.

Note if running these command separately without going through package.json I found it doesn't work,

$ sudo ng build --prod --base-href https://shanegibney.github.io/mathapp/

$ sudo angular-cli-ghpages --branch gh-pages

Got help from a blog post on shermandigital.com


After git push origin master gh - page deploy step 1:"ng build --prod --base-href https://username.github.io/project-name/"

step 2: "ngh --dir dist/project-name"

replace project-name and username of with github username, project-name