How to modify the default port number of react

Time:2021-4-16

problem


We often encounter this situation when we use react, the 3000 port number is occupied. Sometimes we can turn off Port 3000, but more often, when we need to open multiple projects, we have to open multiple ports. At this time, you need to modify the default port number.

terms of settlement


Modify the default port number

specific working means

  • Step one: find start.js file

The location of this file is: node_ Modules folder, react scripts folder, scripts folder start.js

node_ Modules

node_modules下

start.js file

start.js文件

51 line, the entire file port number only appears once

51行处修改

Running results after modification

Write here is the end, hope to help you, ha ha!
I’m cherish. I’m a front-end apprentice at United pictures!