package.json
....
"scripts": {
"start": "BROWSER=none react-app-rewired start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
....
其中在window10 环境下, BROWSER=none 会出错
解决办法
npm install cross-env --save-dev
修改packge.json
....
"scripts": {
"start": "cross-env BROWSER=none react-app-rewired start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
....
cross-env 解决一些跨平台环境变量的问题
网友评论