I was working on this React project and from the beginning I am getting these but I ignored them all and used npm i package_name -f
to install and surely do this command do the job but I want to know what things are causing the issue and I want to know how to fix all these issues. Please don't suggest doing npm audit fix --force
, I have already done that.
Here are the errors that I am getting:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@">=16.8.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/react
npm ERR! peer @emotion/react@"^11.0.0-rc.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/styled
npm ERR! peerOptional @emotion/styled@"^11.3.0" from
@mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! peer @mui/material@"^5.0.0" from @mui/[email protected]
npm ERR! node_modules/@mui/icons-material
npm ERR! 1 more (the root project)
npm ERR! 3 more (@mui/styled-engine, @mui/system, the root project)
npm ERR! peerOptional @emotion/react@"^11.5.0" from @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! peer @mui/material@"^5.0.0" from @mui/[email protected]
npm ERR! node_modules/@mui/icons-material
npm ERR! @mui/icons-material@"^5.10.2" from the root project
npm ERR! 1 more (the root project)
npm ERR! 3 more (@mui/styled-engine, @mui/system, the root project)
npm ERR! peer react@">=16.8.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/styled
npm ERR! peerOptional @emotion/styled@"^11.3.0" from @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! peer @mui/material@"^5.0.0" from @mui/[email protected]
npm ERR! node_modules/@mui/icons-material
npm ERR! @mui/icons-material@"^5.10.2" from the root project
npm ERR! 1 more (the root project)
npm ERR! peerOptional @emotion/styled@"^11.3.0" from @mui/[email protected]
npm ERR! node_modules/@mui/styled-engine
npm ERR! @mui/styled-engine@"^5.10.2" from @mui/[email protected]
npm ERR! node_modules/@mui/system
npm ERR! @mui/system@"^5.10.2" from @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! 2 more (@mui/system, the root project)
npm ERR! 15 more (@mui/base, @mui/icons-material, @mui/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-currency-format
npm ERR! react-currency-format@"^1.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-currency-format
npm ERR! react-currency-format@"^1.1.0" 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.
npm ERR!
npm ERR! See C:\Users\naveen\AppData\Local\npm-cache\eresolve-report.txt for a full report.
CodePudding user response:
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
This says you are using react
v18.2.0. And that the problem is caused by react-currency-format
Could not resolve dependency:
npm ERR! peer react@"^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-currency-format
npm ERR! react-currency-format@"^1.1.0" from the root project
This error message says react-currency-format
v1.1.0 is dependent on react
v15 or v16 or v17 only. So v18 of react
is not supported by this version.
To solve this, either downgrade react
to v17 or get a version of react-currency-format
that supports react
v18 (if it exists)