我使用cli实用程序create-react-app创建了一个项目。 当我使用npm start时,一切都按预期进行。
但是当我尝试运行“ npm run-script build”时,出现以下错误:
./src/index.css
Module build failed: BrowserslistError: Unknown browser query 'dead'
at Array.forEach (<anonymous>)
我具有package.json的以下结构
`{
"name": "site",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-bootstrap": "^0.32.1",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}`
如果我删除“ not dead”,它会建立,但是我感觉自己正在制造一些将来的问题。有人得到这个错误吗?知道解决方法,我是否需要担心取消此操作?
答案 0 :(得分:1)
临时解决方案: 将浏览器列表设置为空
{
"name": "site",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-bootstrap": "^0.32.1",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": []
}