gpt4 book ai didi

javascript - 浏览器列表错误: Unknown browser kaios

转载 作者:行者123 更新时间:2023-12-03 13:07:13 32 4
gpt4 key购买 nike

我已经更新了我的项目以使用最新版本的节点和 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
  • yarn 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 中。我尝试使用其他解决方案,但没有一个有效。

最佳答案

TL;DR rm yarn .lock; yarn

长篇散文:

browserslist 和 postcss-preset-env 都可能是二级(深层)依赖项。这在 create-react-app 中很常见。但是,yarn Upgrade 不会升级锁定的子依赖项,并且执行此操作的命令违反了yarn 的哲学。

可以说,这些库之一应该限制所需的依赖版本,并将其留给 yarn 来解析好的版本。如果是这样,那么 yarn 是正确的。

可以通过为项目创建一些{browserslist, caniuse-lite, postcss-preset-env}直接[dev]依赖项来解决此问题。

或者更短,rm yarn.lock; yarn

引用文献:

关于javascript - 浏览器列表错误: Unknown browser kaios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55681358/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com