Skip to content
the poor coder

how to run react builed version

Poor Man
Published
Reading time
1 min read
On this page

How to Run React Built Version#

If you have developed a React app and built it using the npm run build command, you might be wondering how to run it locally or deploy it to a server. Here are some ways to do it:

Run Locally Using Serve#

You can use the serve package to run your built React app locally. First, install it globally using npm install -g serve. Then, navigate to your app's build directory using the cd command. Finally, run serve -s build. This will serve your app at http://localhost:5000.

Text
$ npm install -g serve
$ cd my-app/build
$ serve -s build

Deploy to a Server#

If you want to deploy your built React app to a server, you can do it manually or use a service like Netlify or Heroku. Here are the steps for manual deployment:

  1. Copy the contents of your app's build directory to your server using FTP or SSH.
  2. Install a web server like Apache or Nginx on your server if it's not already installed.
  3. Create a virtual host or edit the default configuration file to serve your app's build directory.
  4. Restart your web server.

If you're using Netlify or Heroku, you can simply connect your app's Git repository and they will handle the deployment process for you.

Conclusion#

Running a built React app is easy once you know how to do it. Whether you want to run it locally using serve or deploy it to a server, there are multiple ways to do it. Just choose the method that works best for you and follow the steps.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC