react项目和next项目修改默认端口号

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 端口号 即可。

posted @ 2019-02-18 16:49  蓓蕾心晴  阅读(3854)  评论(0编辑  收藏  举报