Hello readers, Today In this article I am going to show you how to Solve – Module not found: Can’t resolve ‘react-router-dom’ error in reactjs. So here I will explain all the possible solutions.
Without wasting your time, Let’s start This Article to Solve This Error.
How to Module not found: Can’t resolve ‘react-router-dom’ Error Occurs?
This is a common error in Python. When I am trying to npm start, the browser gives the error, It looks as like below:
Failed to compile ./src/components/App/App.js Module not found: Can't resolve 'react-router-dom'.
So here are all the possible solutions that I tried to fix this error.
How To Solve Module not found: Can’t resolve ‘react-router-dom’ Error?
- How To Solve Module not found: Can’t resolve ‘react-router-dom’ Error?
To Solve Module not found: Can’t resolve ‘react-router-dom’ Error First you have to install Run this command: npm i react-router-dom AND then run this command: npm i @types/react-router-dom Now, I hope your error will be gone.
- Module not found: Can’t resolve ‘react-router-dom’
To Solve Module not found: Can’t resolve ‘react-router-dom’ Error You Just need to install react-router-dom. Just copy the below command and run it in your terminal: npm install react-router-dom –save Now, Your error will be gone.
Solution 1: Run this command
You Just need to install react-router-dom. Just copy the below command and run it in your terminal.
npm install react-router-dom --save
Now, I hope your error will be gone.
Solution 2: Install react-dom
You Just need to run both commands in your terminal, First of all, Run this command.
npm i react-router-dom
And then run this second command.
npm i @types/react-router-dom
Now, Your error will be solved.
Conclusion
In this article, we have discussed what causes the error and we have discussed ways to fix the error.
we hope this article has been informative. Thank you for reading. Kindly comment and let us know if you found it helpful.