React App
React JS

How to run React Project locally on the static server after build

React App

Hi, you may be looking for the answer of how to run a React Project locally after build or run a React Project on the static server. In this tutorial, I will explain how you can do that after your build is ready.

When your React project build is ready for deployment you may want to run it on your local machine first. So here is some information that will help you to run your React project locally after your build is ready.

How to run a React Project locally

Follow the steps properly to avoid any misunderstanding.

Note: Assuming that you have already made a build of your project by running the command npm run build.

To run a React app locally we will need to install a Static Server. Because the HTML will not run in the browser as we usually do to run any HTML file.

Step 1: Open the command prompt as administrator and run the following command to install a Static Server.

npm install -g serve

Step 2: Go to your project root folder and run this given command.

serve -s build

You will be able to see that your project has started running in the browser. After that, you may want to check How to deploy a React app on a production

Thanks.

Author

I am a Full Stack Web Developer. I have more than 8 years of experience in the web design and development industry.

Leave a Reply

Your email address will not be published. Required fields are marked *