1.) npm install [email protected]
2.) npm install bootstrap
3.)npm install [email protected] popper.js@^1.12.9 bootstrap
But unfortunately each and every time i have to face the same error
(base) ritwikbiswas@Ritwiks-MacBook-Air awesomeapp % npm install [email protected] popper.js@^1.12.9 bootstrap
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @material-ui/[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.15.17" 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.15.17" 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.15.14" from @mui/[email protected]
npm ERR! node_modules/@mui/system
npm ERR! @mui/system@"^5.15.15" from @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR! 2 more (@mui/system, the root project)
npm ERR! 14 more (@emotion/use-insertion-effect-with-fallbacks, ...)
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! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
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.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/ritwikbiswas/.npm/_logs/2024-05-12T06_15_53_877Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ritwikbiswas/.npm/_logs/2024-05-12T06_15_53_877Z-debug-0.log
(base) ritwikbiswas@Ritwiks-MacBook-Air awesomeapp %
I expect to install bootstrap in my current react version
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-scripts": "5.0.1",
2
Answers
Seems like a dependency isn’t able to resolve correctly due to higher react version. Update any older dependencies or downgrade react.
As you can see here the error is caused due higher react version
Like Jayendra said, the issue isn’t actually with the packages you’re trying to install. The issue is with material-ui. There’s 2 approaches you can take. Well 3, but please don’t take the third.
@material-ui/core
and see if there’s a newer version that uses the most recent React version, or in your case, 18.3.1.npm install xxxx yyyy zzzz --legacy-peer-deps
which just means that npm should resort to the way they used to handle this error, and just yell at you about it without blowing up your app.My advice? Try 1. If that doesn’t work, try 2, and just look away when the warnings try to tell you you’re doing something wrong.