
creat-react-app生成的项目默认端口号是3000,如下可以更改:
在package.json中修改
"start":"react-scripts start",
为
"start":"set PORT=9000 && react-scripts start",
next.js按文档生成的项目默认也是3000
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "next -p 9000"
},
加 -p 端口号 即可。