Error: Unable to resolve module 'XXXXX' could not be found within the project

Viewed 1049

I'm keep getting this error whenever I try to install any npm package on my windows 10 for android. It shows the package added in android studio and node_modules as well. However when i import the npm package in JS file and run the project the error comes up. With the below instructions :

If you are sure the module exists, try these steps:

  1. Clear watchman watches: watchman watch-del-all
  2. Delete node_modules: rm -rf node_modules and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*

Does anyone knows what i'm doing wrong? I'm using react-native 0.63.2

2 Answers

It means the metro bundler does not know there is a new package installed. In that case, turn off the metro bundler and follow the steps you listed above and then npx react-native run-android. Those steps clear the cache and help metro find the new package that was installed.

enter image description here Check in any of the files you were working on recently and be sure you are not mistakenly importing XXXXX somewhere, in my case it was process as shown in the image above. Most times it happens when you invoke a function or method within your module

Related