close

[Solved] Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’

Hello Guys, How are you all? Hope You all Are Fine. Today After npm start, the browser gives the error Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’ in reactjs. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’ Error Occurs ?

Just After npm start, the browser gives the error:

Failed to compile ./src/components/App/App.js Module not found: Can't resolve 'react-router-dom'.

How To Solve Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’ Error ?

  1. How To Solve Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’ Error?

    To Solve Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’ Error The following command will resolve this error. Just run the below command in your terminal. npm install react-router-dom –save

  2. Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’

    To Solve Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’ Error The following command will resolve this error. Just run the below command in your terminal. npm install react-router-dom –save

Solution 1

The following command will resolve this error. Just run the below command in your terminal.

npm install react-router-dom --save

Solution 2

I use Typescript and I needed to install

npm i react-router-dom

AND

npm i @types/react-router-dom

After both installations errors are gone.

Solution 3

  1. npm install –save react-router-dom
  2. <script src=”https://unpkg.com/react-router-dom/umd/react-router-dom.min.js”></script>
  3. script tag put in public/index.js

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

2 thoughts on “[Solved] Failed to compile ./src/components/App/App.js Module not found: Can’t resolve ‘react-router-dom’”

Leave a Comment