I have a Flask server with a react app. When I run the npm build script, it builds the 'build' folder. When flask attempts to render the html for my react app, I get the error for the Unexpected token '<' for 2.ed52de7f.chunk.js. It seems rather simple, but I have been stuck on this for a while and I desperately need help. The app renders fine when I open it using 'npm run start'.
Asked
Active
Viewed 1,399 times
-1
-
How did you set up your package.json? – ngood97 Oct 17 '19 at 23:55
-
I basically create-react-scripts and downloaded a a few other dependencies using npm install *package name*. – Andrew Desousa Oct 18 '19 at 00:04
-
Possible duplicate of [syntax error: unexpected token <](https://stackoverflow.com/questions/18561556/syntax-error-unexpected-token) – ngood97 Oct 18 '19 at 00:08
1 Answers
1
Unexpected token '<' for 2.ed52de7f.chunk.js
This means the request to get the static js file returns a HTML instead of javascript. You can do following things:
- Check the url of chunk.js again, make sure it point to correct server
- Trying to request that js with its url you will figure out the error
Hope this help

goooooooo
- 90
- 1
- 5