//in package.json
"start": "react-scripts start"
t0
//linux
"start": "PORT=3006 react-scripts start"
or
"start": "export PORT=3006 react-scripts start"
//windows
"start": "set PORT=3006 && react-scripts start"
//If you don't want to set the environment variable, another option is to modify the scripts part of package.json from:
"start": "react-scripts start"
//to
//Linux (tested on Ubuntu 14.04/16.04) and MacOS (tested by aswin-s on MacOS Sierra 10.12.4):
"start": "PORT=3006 react-scripts start"
//or (may be) more general solution by IsaacPak
"start": "export PORT=3006 react-scripts start"
//Windows
"start": "set PORT=3006 && react-scripts start"
// Ubuntu / CentOS / RHEL / MacOS environment:
...
"scripts": {
"start": "PORT=8000 react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-app-rewired eject"
}
...
PORT=5010 react-scripts start
#Create a .env file at your project root and specify port number there. Like:
PORT=3005