纱线警告"has unmet peer dependency" .这是怎么回事?



控制台警告:

warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
warning " > @testing-library/user-event@13.5.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".

当我安装或删除包时出现此警告。我不知道该怎么处理这个。

纱版:

$ yarn -v
1.22.17

package.json中的依赖:

"dependencies": {
"axios": "^0.24.0",
"dotenv": "^10.0.0",
"mobx": "^6.5.0",
"mobx-react-lite": "^3.3.0",
"node-sass": "^7.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-dropzone": "^12.0.4",
"react-hook-form": "^7.29.0",
"react-id-swiper": "^4.0.0",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"react-transition-group": "^4.4.2",
"swiper": "^7.4.1",
"web-vitals": "^2.1.2"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"@types/dotenv": "^8.2.0",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.17",
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"prettier": "^2.5.1",
"typescript": "^4.5.4"
}

实际上,我甚至删除了node_modulesyarn install,但它没有帮助我,你可以看到。

我也试图安装这个依赖项,但它导致了新的错误,破坏了我的应用程序。

对等依赖项应该由您自己安装。通常,目的是防止版本冲突。

所以,当你读到这样的消息时:

warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".

这仅仅意味着你(间接)使用的依赖eslint-plugin-flowtype(通过react-scripts)要求你在package.json中添加@babel/plugin-syntax-flow作为依赖。

最新更新