用create-react-app创建项目后怎么把默认的3000端口改掉?

想了解具体的可参考 https://www.jianshu.com/p/6effa6f8059b

1. 第一种:在node_modules\react-scripts\bin\react-scripts.js 中找到DEFAULT_PORT=parseInt(process.env,PORT,10)||3000 将3000改为4000即可
2. 第二种:在packjson.json中将script中将 "start": "react-scripts start" 改为 "start": "set PORT=3001&&react-scripts start"

猜你喜欢

转载自www.cnblogs.com/xiaopange/p/11451631.html