While trying to install npm install
, I am getting below error, could someone please advise, what is the best approach to resolve the problem. Due to this error, my build is getting failed in netlify.
error: $
npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
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"
]
}
}
CodePudding user response:
Try this
npm config set legacy-peer-deps true
npm i