[英]How to solve this error: package.json » eslint-config-react-app/jest#overrides[0]: Environment key "jest/globals" is unknown
Unable to launch my app using sudo yarn build
I am getting this error:无法使用
sudo yarn build
启动我的应用程序我收到此错误:
package.json » eslint-config-react-app/jest#overrides[0]:
Environment key "jest/globals" is unknown
What would be a solution for this error?这个错误的解决方案是什么?
This is due to error in node_modules Delete node_modules from file directory manually and try running this code in terminal of VSCode:这是由于 node_modules 中的错误手动从文件目录中删除 node_modules 并尝试在 VSCode 的终端中运行此代码:
npm install
Update Package.json(Remove "react-app/jest" from extends array更新 Package.json(从扩展数组中删除“react-app/jest”
"eslintConfig": { "extends": [ "react-app" ] },
if you are using eslintconfig delete that or remove the react-app/jest from there extends array and keep only react-app Run npm install and check again It works It should work.如果您正在使用 eslintconfig 删除它或从那里删除 react-app/jest 扩展数组并仅保留 react-app 运行 npm 安装并再次检查 它可以工作 它应该可以工作。
I had the same issue with npm.我对 npm 也有同样的问题。
Resolution took editing package.json分辨率带编辑 package.json
Find and remove the whole eslintConfig查找并删除整个 eslintConfig
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
also I had devDependencies that needed to be removed.我也有需要删除的 devDependencies。
"devDependencies": {
"eslint": "7.30.0",
"eslint-config-airbnb": "18.2.1",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-react": "7.24.0",
"eslint-plugin-react-hooks": "4.2.0",
"prettier": "2.3.2"
}
I ran "npm install".我跑了“npm install”。 The error cleared.
错误清除。 Then I added all of the above back into the package.json.
然后我将以上所有内容添加回 package.json。 I ran "npm install" again with no errors.
我再次运行“npm install”,没有任何错误。
npm install -- solved it for me npm 安装——帮我解决了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.