Set PORT still first tries to run on 3000 React App

Viewed 222

I have two react apps that I am trying to run using pm2. One app is running fine on port 3000. When I try to run second app, it fails to run.

I have specified port number in package.json file i.e 3001, still it gives a message that some other program might be using port 3000, do you want to run your app on another port? If I press Y, it starts running fine on 3001, but with pm2, I think we can't have this option to get a response this way.

Can Anyone help? Thanks in advance.

1 Answers

How have you specified the port number in package.json?

"start": "export PORT=3001 react-scripts start"

Have you tried using cross-env package?

Related