18
loading...
This website collects cookies to deliver better user experience
homepage
and proxy
inside package.json
file.If you don't have any problems browsing other websites, you'll most likely have Javascript enabled.
The following solution is trying to solve the issue when running the development server. If you're facing this issue only after running the production build, skip to the next section.
package.json
file."proxy": "http://localhost:5000"
Make sure to change port 5000 to whatever port number the server is set up to listen to.
package.json
file."homepage": "."
index.js
file.app.use(express.static(__dirname));
app.get("/*", function(req, res) {
res.sendFile(path.join(__dirname, "index.html"));
});
We have an in-depth guide covering this topic. Follow the link on How to Run React Build Locally.
serve
. And use it to serve a production build.npm install -g serve
# Or if you're using Yarn
yarn global add serve
serve
package which folder you want to serve. Assuming you're inside your project directory. You'd run a command like this.serve build