React Native unable to resolve module @react-native/assets/registry

Viewed 156

I’ve been facing a weird error in my react native (v0.68.2) project for a week now I would really appreciate any help its been driving me crazy.

For some reason, the assets folder inside the @react-native folder in node_modules seems to get deleted on its own causing this error:

Error: unable to resolve module @react-native/assets/registry from /Users/xx/ApplicationPath/node_modules/react-native/Libraries/Image/resolveAssetSource.js: @react-native/assets/registry could not be found within the project or in these directories:

From what I can tell when I delete the node_modules folder and run yarn or npm install the assets folder is installed correctly within @react-native but after some time it randomly gets deleted and I have no idea why. A similar thing happens in the @react-navigation/elements/src folder the assets folder also gets deleted.

After deleting node_modules and running yarn

A few moments later

1 Answers

I had the same thing happen and figured out that I had a file .yarnclean that was removing assets/ folder and a bunch of other 'unneccesary' things. Check if that exists.

Related