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 ?
- 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
- 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
- npm install –save react-router-dom
- <script src=”https://unpkg.com/react-router-dom/umd/react-router-dom.min.js”></script>
- 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
worked for me
Thanks guy it has saved my time.