Issue
I've been trying to deploy my angular 2 app to github pages so I can view the app on the hosted github link but no luck so far.
As soon as I finished my app, I ran these commands:
ng build --prod
git remote add origin "My REPO"
git commit -a
git push -u origin master
I then tried to running on terminal
ng github-pages:deploy
and got this error:
The specified command github-pages:deploy is invalid. For available options, see `ng help`.
After researching I ran across this page and followed the instructions: https://www.npmjs.com/package/angular-cli-github-pages
I installed angular-cli-github-pages via npm on my project directory:
npm install --save-dev angular-cli-github-pages
it says I have to create the gh-pages so I ran this command below:
git checkout --orphan gh-pages
and then committed the files and pushed the changes and returned back to the origin master and ran the deploy command and it gave me the same error:
The specified command github-pages:deploy is invalid. For available options, see `ng help`.
I've been going back and forth with different methods and it's not working. Can someone please point what I should do to properly deploy this to github pages?
Solution
I faced the same issue recently. After scouring the angular2 community for hours I was able to find that the angular-cli-github-pages module has been removed in the latest angular-cli release. To deploy your Angular 2 apps to gh-pages , you now need to install a new npm module which is quite similar to the older angular-cli-github-pages module but makes you do a little more work that the previous module.
The npm module is angular-cli-ghpages . You can find the documentation and steps on the npmjs page for the module.
Hope this helps you.
Answered By - Armaan Goyal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.