Welcome to Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy

How to Run React Build for Production Using PM2

Install the PM2 tool

it helps to run the react.js app in the background.
				
					npm install pm2 -g
				
			

Create a new file with the name app.config.json below the build folder and add the following snippet.

				
					{
  apps : [
    {
      name      : "react-app",
      script    : "npx",
      interpreter: "none",
      args: "serve -s build -p 3000"
    }
  ]
}
				
			

I’m running my React app on a 3000 port you can change your port number

Run the following pm2 command which will start the app on your cloud instance ( i.e we are using AWS EC2).

				
					pm2 start app.config.json
				
			

This command will you show the list of the pm2 running processes.

				
					pm2 list
				
			
Run React Build Using PM2

Drop your queries

Table of Contents

Have A Project In Mind? Let's Get To Work