Deployed site: Uncaught SyntaxError: Unexpected token <
See original GitHub issueAfter building the site with:
ng build --prod --base-href "https;//<username>.github.io/<reponame>/
I can run the site with no issues on a local server.
However, after publishing via ngh, the online site just gives the following error 4 times:
SyntaxError: Unexpected token < (index):1
No other errors or information is given, so I have no idea what to do.
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (5 by maintainers)
Top Results From Across the Web
Uncaught SyntaxError: Unexpected token '<' - Stack Overflow
I uploaded my react project to Netlify but when I clicked on the link nothing came out and there was the following error...
Read more >"Uncaught SyntaxError: Unexpected token <" after firebase ...
Ths issue is caused when a new version of firebase hosting is deployed, it might have wiped out all the resources serving from...
Read more >uncaught syntaxerror: unexpected token '<' - Build debugging
Hello trying to deploy a mern app. I built the front-end following the create-react-app docs, placed the build in the backend and proceeded ......
Read more >Error "Uncaught SyntaxError: Invalid or Unexpected Token ...
Coding example for the question Error "Uncaught SyntaxError: Invalid or Unexpected Token", When Deploying Site on Netlify-Reactjs.
Read more >Unexpected token <' has been thrown (node.js, express) - Quora
How do you deploy to Heroku when "Uncaught SyntaxError: Unexpected token <" has ... part of the page, rather than getting to a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I was facing the same issue .This is due the creation of project directory inside the dist folder which is not being pointed by index.html. Fixed it by changing the base tag from
<base href="/">to<base href="/project-app/">inside index.html file.From my understanding, github pages require a
_config.ymlfile, so the project structure I uploaded had to look like the following:Until I had
_config.yml, the site would constantly fail with the error in the original post. It worked as soon as the file was present.Inside
_config.ymlI specified the base URL:baseurl: /ng2-parallaxscrollHere’s the full project, check the
origin/docsbranch for the website source, and thegh-pagesfor the built output: https://github.com/TyrantWave/ng2-parallaxscrollTo add the
_config.ymlto the output, I added it to theangular.cli.jsonassets folder: