Create-React-App build – “Uncaught SyntaxError: Unexpected token

Thanks this helped me a lot.
Just wanting to add to this with an example from a Create-React-App project that had the same solution:
I received the same error after deploying to heroku.

Uncaught SyntaxError: Unexpected token < after serve -s build

For me the problem was in the packages.json file. The “homepage” parameter i gave was incorrect. Changing this to the correct heroku URL solved the issue.

"homepage": "https://myapp.herokuapp.com/"

Hope this addition is helpful.

Leave a Comment