How to run build version using create-react-app?

When you run npm run build your console should actually say something like the following

The build folder is ready to be deployed.
You may serve it with a static server:

npm install -g serve
serve -s build

The build script is building your entire app into the build folder, ready to be statically served. However actually serving it require some kind of static file server, like the the one they propose.

After running the command serve -s build you can access your production build at localhost (on the specified port).

You can of course run whatever static file server you like, I usually use express for this, however serve seems like the easiest option to just serve your statics files with a single command.


Navigate inside the directory of your app first.

According to the official create-react-app website. When you run npm run build you create a build directory with a production build of your app.

After running the command above the next thing you can do to check the build version of your app is to to install serve to serve your status site on the port 5000 by default.

npm install -g serve
serve -s build

This will copy the link to your clipboard that you can paste in your browser and see the build version of you app.


Also you can use "serve" tool, using "npx". in this case no need to install it globally.

npx serve -s build