Here’s how to make a React application created using Create React App use a different port.
In your package.json
file under the scripts
section for start
, add the parameter PORT=YOURPORTNUMBER
before the react-scripts start
command.
"scripts": {
"start": "PORT=3001 react-scripts start",
}