re: Error when serving React app from sub-folder VIEW POST

FULL DISCUSSION
 

I was able to replicate your issue. The problem is serve. When you run serve -s build it starts the HTTP server. When you go to http://localhost:5000 in your browser it sends an HTTP request for / to serve. It will respond with ./build/index.html, which references assets from /newroot/static/..... But, there is no newroot directory inside your build directory. So it responds with ./build/index.html due to the -s flag.

If you rename the build directory to newroot and run serve . then you will be able to load your application at localhost:5000/newroot but navigation may not work correctly depending on what you are doing.

If you are trying to test the production deployment of your application you should do so in a production-like environment, not locally.

code of conduct - report abuse