Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

React.js : How to start a react application on a different port

I just have started learning React.js and made two projects using Create React App.

Now if I want to start both projects at the same time, I can’t because both start on port 3000 by default.

Is there any way I can change the default port of one of them to something else like http://localhost:3001 and run them simultaneously?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Note: I’m a Windows user

>Solution :

Modify start command from scripts section of package.json.

"start": “set PORT=3005 && react-scripts start"

There are couple of other ways also.
Refer this link
https://tech.amikelive.com/node-830/reactjs-changing-default-port-3000-in-create-react-app/

PS:
You can specify the port number which you want.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading