javascript – Failed to compile. Module not found: Cant resolve react-router-dom

javascript – Failed to compile. Module not found: Cant 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.

javascript – Failed to compile. Module not found: Cant resolve react-router-dom

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

Leave a Reply

Your email address will not be published. Required fields are marked *