Angular github pages path has duplicate app names

560 Views Asked by At

I tried to build and deploy angular-tou-of-heroes application to github, but always got duplicate app name in the path. Could anybody help me with this issue?

My build command is ng build --prod --output-path docs --base-href angular-tour-of-heroes I deployed from Github /doc directory. When click the link, it keep redirect to the flowing path, which has two tour-of-heroes in it https://frankxiao008.github.io/angular-tour-of-heroes/angular-tour-of-heroes/

Here is my Github repository link for my code. https://github.com/frankxiao008/angular-tour-of-heroes

I followed this instruction enter image description here

1

There are 1 best solutions below

2
Quan VO On

I just pulled your project and tested it with a local server. I think there was a mistake in the documentation. If you set --base-href to an x value, your application will use /x as the based path. See the base tag.

The solution is simple, let it have the default value by removing the option

ng build --prod --output-path docs

or set it to the current directory

ng build --prod --output-path docs --base-href .

I hope this will help.