I could able to start react js with default port 3000. But, when I customised the port to 4200, "start": "PORT=4200 react-scripts start"(Just changed in the package.json), I am not able to start the react js application.
'PORT' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `PORT=4200 react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional lo
ging output above.
npm ERR! A complete log of this run can be found in:
to start APP on another port run the following npm command
npm start --port 3002
or to config in package use
replace the start command with below
"start": "set PORT=3006 && react-scripts start"
An other option that was not mentioned in the other answer would be to create a .env file in the root directory and put PORT=4200 in it. It will automatically be loaded in your environment variables. 
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With