【发布时间】:2022-08-20 11:39:30
【问题描述】:
在尝试安装npm install 时,我遇到了错误,有人可以建议,解决问题的最佳方法是什么。由于这个错误,我的构建在 netlify 中失败了。
错误: $
npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: sssclub@0.1.0
npm ERR! Found: react@18.1.0
npm ERR! node_modules/react
npm ERR! react@\"^18.0.0\" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@\"^16.8.0 || ^17.0.0\" from @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR! @material-ui/core@\"^4.12.4\" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
// package.json
{
\"name\": \"sssclub\",
\"version\": \"0.1.0\",
\"private\": true,
\"dependencies\": {
\"@emotion/react\": \"^11.9.0\",
\"@emotion/styled\": \"^11.8.1\",
\"@material-ui/core\": \"^4.12.4\",
\"@mui/icons-material\": \"^5.8.3\",
\"@mui/material\": \"^5.8.3\",
\"@testing-library/jest-dom\": \"^5.16.4\",
\"@testing-library/react\": \"^13.1.1\",
\"@testing-library/user-event\": \"^13.5.0\",
\"axios\": \"^0.27.2\",
\"cors\": \"^2.8.5\",
\"express\": \"^4.18.1\",
\"multer\": \"^1.4.4\",
\"mysql2\": \"^2.3.3\",
\"path\": \"^0.12.7\",
\"react\": \"^18.0.0\",
\"react-dom\": \"^18.0.0\",
\"react-hook-form\": \"^7.31.2\",
\"react-router-dom\": \"^6.3.0\",
\"react-scripts\": \"^5.0.1\",
\"react-tweet-embed\": \"^2.0.0\",
\"sequelize\": \"^6.20.1\",
\"web-vitals\": \"^2.1.4\"
},
\"engines\": {
\"node\": \"16.14.2\",
\"npm\": \"8.5.0\"
},
\"proxy\": \"http://localhost:8000\",
\"scripts\": {
\"start\": \"react-scripts start\",
\"start:server\": \"node src/server.js\",
\"build\": \"react-scripts build\",
\"test\": \"react-scripts test\",
\"eject\": \"react-scripts eject\",
\"preinstall\": \"npx npm-force-resolutions\"
},
\"eslintConfig\": {
\"extends\": [
\"react-app\",
\"react-app/jest\"
]
},
\"browserslist\": {
\"production\": [
\">0.2%\",
\"not dead\",
\"not op_mini all\"
],
\"development\": [
\"last 1 chrome version\",
\"last 1 firefox version\",
\"last 1 safari version\"
]
}
}
标签: reactjs react-hooks