13

I downloaded the React App package from the link create-react-app. The default port it assigns is port:3000

How to Change this port to a custom port like 3002 or 3006 ?

Sanchit Bhatnagar
  • 874
  • 2
  • 10
  • 16

1 Answers1

50

modify part of package.json from:

"start": "react-scripts start"

for Linux and MacOS to:

"start": "PORT=3006 react-scripts start"

Windows to:

"start": "set PORT=3006 && react-scripts start"
Dinesh undefined
  • 5,490
  • 2
  • 19
  • 40
nishant
  • 2,526
  • 1
  • 13
  • 19