Failed to compile. Module not found: Can't resolve 'react-router-dom'

I was facing the same issue. The following command will resolve it:

npm install react-router-dom --save


In my case I use Typescript and I needed to install

npm i react-router-dom

AND

npm i @types/react-router-dom

After both installations errors gone.


This error fix by following steps.
Step.1: npm install --save react-router-dom
Step.2:<script src="https://unpkg.com/react-router-dom/umd/react-router-dom.min.js"></script>
script tag put in public/index.js