skip to Main Content

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


  1. 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

    While resolving: @material-ui/[email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! peer react@">=16.8.0"
    
    Login or Signup to reply.
  2. 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.

    1. Look into @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.
    2. Override the error and hope for the best with 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.
    3. Downgrade React to fit what material is looking for. This is almost never a good idea as the rest of your dependencies are more likely to be looking for a more recent version, as compared to the 1 or 2 that are likely to be looking for a previous version.

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search