Could not resolve dependency: peer react@"^16 || ^17" from react-top-loading-bar@2.1.0

Viewed 108

I'm trying to install npm i react-top-loading-bar but I got following error:

ERR! code ERESOLVE   
npm ERR! ERESOLVE unable to resolve dependency tree 
npm ERR! While resolving: newsapp@0.1.0 
npm ERR! Found: react@18.2.0 
npm ERR! node_modules/react 
npm ERR!   react@"^18.2.0" from the root project
npm ERR! Could not resolve dependency: 
npm ERR! peer react@"^16 || ^17" from react-top-loading-bar@2.1.0 
npm ERR! node_modules/react-top-loading-bar 
npm ERR!   react-top-loading-bar@"*" from the root project 
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 
1 Answers

try running

npm i react-top-loading-bar --force 

or

npm i react-top-loading-bar --legacy-peer-deps

if it doesnot work try downgrading your node version.

Related