Home >Web Front-end >JS Tutorial >How to change the port number in react?
How to modify the port number in react: 1. Open the "node_modules"-"react-scripts"-"scripts" folder in sequence, find and open the start.js file; 2. Search in the start.js file And modify the value of the "DEFAULT_PORT" item.
The operating environment of this tutorial: windows7 system, react16 version. This method is suitable for all brands of computers.
Problem
We often encounter this situation when using React, the 3000 port number is occupied. Sometimes port 3000 can be turned off, but more often, when we need to open multiple projects, we must open multiple ports. At this time, you need to modify the default port number.
Solution: Modify the default port number
Specific Method
The location of this file is: under the node_modules folder-> under the react-scripts folder -> Under the scripts folder-> Under start.js
node_modules:
##start.js file: Modify at line 51, the entire file port number only appears once The running result after modificationFor more programming-related knowledge, please visit:
Introduction to Programming! !
The above is the detailed content of How to change the port number in react?. For more information, please follow other related articles on the PHP Chinese website!