Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
deploy angular 2 app to github pages - failed

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?

about 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

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.

about 4 years ago · Santiago Trujillo Denunciar

0

I find that the easiest way to deploy to Github Pages is to either use master branch or docs in master branch as the source option in Settings. I go for the docs in master branch option and treat the docs folder as the build directory. It has worked pretty well. I just push to master, Github detects the docs folder and then creates the app/page with its contents.

about 4 years ago · Santiago Trujillo Denunciar

0

At First Install angular-cli ghpages

npm install -g angular-cli-ghpages

After installing next step is linking your repository. Run this command

ng build --prod --base-href "https://<user-name>.github.io/<repo>/" 

If You See Error Then ommit --prod and Run This Command

ng build --base-href "https://<user-name>.github.io/<repo>/" 

You can now see a dist folder in your angular 2 app directory.

Upload all files of dist folder on github repository.

Then From Settings Enable Github Pages. A link will be provided to you.

That's It.

Demo : https://shawon100.github.io/angularmaterial/

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda