Specify port with the run command
In this method, We don’t need to edit any files inside the react app. We have to just mention the port with the run command of the react project. the user has to use the below command to run the project instead of npm start.
PORT=<specify_port_of_your_choice> npm start
Example:
PORT=5000 npm start
When the user will run the react project using the above command, it will start on the port of the user’s choice.
How to specify a port to run a create-react-app based project ?
Usually the react app server runs on the port 3000. But there may be some situations, where user needs to specify a port to run the react app. So, users need to change the default port of the application and sepcify a custom port to run the application.
Contact Us