Search code examples
javascriptnode.jsreactjsnpmhamburger-menu

Can't install react-burger-menu


When I try to install the react-burger-menu thingy on react using the npm install react-burger --save, it gives out this error and I cannot continue my project:

npm ERR! While resolving: MYPROJECT npm ERR! Found: react@18.2.0 npm ERR! node_modules/react npm ERR! react@"^18.2.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@">=0.14.0 <17.0.0" from react-burger-menu@2.9.2 npm ERR! node_modules/react-burger-menu npm ERR! react-burger-menu@"2.9.2" 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!

How can I successfully install the burger menu?

Thanks in advance.


Solution

  • Package You're trying to download in only available for react version lesser than or equal to 17. You can use this package by downgrading from React 18 to React 17 by,

    npm install react@17.0.0 react-dom@17.0.0
    

    Or alternatively :

    You can use another package for react burger thing ;-). May be I can help for alternate package ?