我已经更新了我的项目以使用最新版本的 node 和 yarn,在这次升级之后,现在我的 react 项目不想使用“browserslist”。
我运行“yarn start”并得到这个错误:
./src/assets/css/material-dashboard-react.css?v=1.2.0 (./node_modules/css-loader??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/assets/css/material-dashboard-react.css?v=1.2.0)
BrowserslistError: Unknown browser kaios
at Array.reduce (<anonymous>)
at Array.some (<anonymous>)
at Array.filter (<anonymous>)
at new Promise (<anonymous>)
我有以下版本:
- 节点 v10.15.3
- npm 6.9.0
- 纱线 v1.15.2
而我的 package.json 它
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "3.9.3",
"@material-ui/icons": "3.0.2",
"axios": "0.18.0",
"classnames": "2.2.6",
"html2canvas": "^1.0.0-alpha.12",
"immutable": "3.8.2",
"jspdf": "^1.4.1",
"jspdf-autotable": "^2.3.5",
"moment": "2.22.2",
"npm-run-all": "4.1.5",
"perfect-scrollbar": "1.4.0",
"plotly.js": "1.47.1",
"react": "^16.6.3",
"react-currency-format": "1.0.0",
"react-dates": "18.2.2",
"react-dom": "^16.6.3",
"react-excel-workbook": "0.0.4",
"react-google-maps": "9.4.5",
"react-plotly.js": "2.3.0",
"react-redux": "6.0.0",
"react-router": "4.3.1",
"react-router-dom": "4.3.1",
"react-scripts": "2.1.8",
"react-select": "2.1.2",
"react-swipeable-views": "0.13.1",
"redux": "4.0.1",
"redux-immutable": "4.0.0",
"redux-persist": "5.10.0",
"redux-thunk": "2.3.0",
"weather-icons": "^1.3.2"
},
"scripts": {
"start": "react-scripts --max-old-space-size=8192 start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">1%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
对我来说,它与 css-loader 有关的问题,我尝试解决问题并将 css-loader@2.1.1 添加到 package.json。我尝试使用其他解决方案,但没有一个有效。