1

I built an Angular project running the ng build command, and locally it works perfectly.

I uploaded the content of the dist folder to a repository in Github and created its GitHub Page, however, it does not render anything. Looking at the console, it throws errors saying that it can't find any of the bundle files.

The browser trying to find these files outside the repository

Why isn't it looking the files in the folder where is the repository but outside?

Thanks.

4
  • 1
    can you post link for github repo? Commented Dec 14, 2019 at 2:44
  • Sure! here it is: github.com/jcrr1985/tutenTestD Commented Dec 14, 2019 at 4:42
  • 1
    I am not seeing gh-pages branch there. Post the link where the gh-pages branch is present. Commented Dec 14, 2019 at 4:58
  • there you go: jcrr1985.github.io/tutenTestD Commented Dec 14, 2019 at 8:31

1 Answer 1

2

You need to change base href of your index.html.

Add your github pages url to base href

<base href="https://jcrr1985.github.io/tutenTestD/">

I have forked your github and now its working fine. Check index.html.

index.html

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Tuten</title> 
    <base href="https://jcrr1985.github.io/tutenTestD/"> <!-- changes here -->

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/x-icon" href="favicon.ico">

    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>

<body>
    <app-root></app-root>
    <script type="text/javascript" src="runtime.js"></script><script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="styles.js"></script><script type="text/javascript" src="vendor.js"></script><script type="text/javascript" src="main.js"></script></body>

</html>
Sign up to request clarification or add additional context in comments.

Comments

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.