0

I'm trying to publish my Angular project https://github.com/KrishnaVeer7712/Reactive-and-Dynamic-Web-Page using Github pages at https://krishnaveer7712.github.io/Reactive-and-Dynamic-Web-Page/ but i'm getting error 404 Page not found. It is working fine when i open my project on localhost.

Steps I've done:

ng build --prod --base-href /Reactive-and-Dynamic-Web-Page/ works fine

gh-pages -d dist (Published)

enter image description here

I don't know where i'm doing wrong , can anyone please tell me what could be the reason.

5
  • 1
    Check this official documentation Commented Aug 30, 2020 at 18:10
  • Check my post: medium.com/javascript-in-plain-english/… Commented Aug 30, 2020 at 21:17
  • @MiroslavMaksimovic Thank you for reply but script 'npm run build-and-deploy-gh-pages' not working, getting error : 'npm ERR! missing script: build-and-deploy-gh-pages' Commented Aug 31, 2020 at 5:05
  • You have to put this script inside your package json scripts array: "build-and-deploy-gh-pages": "ng build --prod --base-href ./ && npx ngh --dir dist/[reponame]" or in terminal just run it like this: ng build --prod --base-href ./ && npx ngh --dir dist/[reponame] Commented Aug 31, 2020 at 6:59
  • There is a working repo at the end of the post: github.com/ngQuad/website/blob/develop/package.json Commented Aug 31, 2020 at 6:59

1 Answer 1

1

maybe you must specify the directory of your build and not the dist directory

gh-pages -d dist/your_application_name

Hope this can help you

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for replying but i already tried this too 'gh-pages -d dist/Reactive-and-Dynamic-Web-Page' (Published) but giving same error 404 page not found.
Hi, a possible solution to your problem is to specify the absolute url ( krishnaveer7712.github.io/Reactive-and-Dynamic-Web-Page in this case) in the base-href parameter when you build your application. For more information see this article, medium.com/tech-insights/…. Hope this can help yout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.