Module not found: Can’t resolve ‘any_module’ in React [Solved]

How to solve Module not found: Can’t resolve in react and any project based on node js.

I started react development few month ago with a huge course on udemy. I tought i master javascript until i started this course.

During one of the main project, i met some repetitive errors that can expand in any web development that require node npm.

At some point, you will struggle with this kind of error:

Module not found: Can't resolve 'any_module'

There are several way to fix it, but one of the solution most developer agree is to delete node_modules and reinstall it.

In the next section, i give step by step command line to do it in linux terminal.

Module not found: Can’t resolve ‘any_module’ in React

Here the command line to solve module not found errors :

rm -rf node_modules
rm -f package-lock.json

# clean npm cache
npm cache clean --force

# install packages
npm install

Now happy coding !

Leave a Comment