gpt4 book ai didi

javascript - browserslists 导致 npm 构建问题/错误

转载 作者:行者123 更新时间:2023-12-02 23:57:28 28 4
gpt4 key购买 nike

我的 create-react-app 无法构建,出现以下错误:

./src/index.css
Module build failed: BrowserslistError: Unknown browser query `dead`
at Array.forEach (<anonymous>)

我已经检查了我的 package-lock.json 并更新了所有依赖 browserslist 的包,但其中一些包没有更新到以上 v3,我认为这就是问题所在,它们是:

-自动前缀-babel-预设-env-babel-预设-react-app-postcss-合并规则

我可以删除这些软件包吗 - 尽管其他软件包依赖于它们,但我有点不知所措,该应用程序运行良好,但无法构建,因此肯定无法在开发服务器上运行?

我的 package.json 是:

   {
"name": "dashboard",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "latest",
"@shopify/polaris": "latest",
"autoprefixer": "^9.5.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react-app": "^7.0.2",
"browserslist": "^4.5.2",
"caniuse-api": "^3.0.0",
"chalk": "^2.0.1",
"css-loader": "^2.1.1",
"cssnano": "^4.1.10",
"dns": "^0.2.2",
"module": "^1.2.5",
"mongodb": "^3.1.10",
"mongoose": "^5.4.3",
"postcss-merge-rules": "^4.0.3",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-router": "latest",
"react-router-dom": "^4.3.1",
"react-scripts": "^1.1.4",
"serve": "^10.1.2",
"start": "^5.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"babel-jest": "^23.6.0",
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.7.0",
"enzyme-to-json": "^3.3.4",
"jest": "^23.6.0"
},
"jest": {
"snapshotSerializers": [
"enzyme-to-json/serializer"
]
}
}

最佳答案

当您说您完成了软件包锁定并更新了版本时,您确定在执行此操作后再次运行 npm install 吗?

您可以尝试运行 npm update 来查看是否可以解决您的问题。

如果仍然无法解决问题,您可以运行 npm ls 列出所有包及其依赖项,以尝试查找与以前版本的 BrowserList 有依赖项的包,检查该软件包的版本以检查您是否可以更新它,如果不能,那么您可能需要与该软件包的所有者联系

关于javascript - browserslists 导致 npm 构建问题/错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55307883/

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