Search code examples
react-nativemetro-bundlerreact-native-gesture-handler

Why is metro builder unable to resolve a 'main' module specified within react-native-gesture-handler?


So I installed the react-navigation 5.x following the documentation, and after pasting the import 'react-native-gesture-handler'; in my index.js and internal error popped up stating it couldn't resolve some 'main' module which is specified in the package.json of react-native-gesture-handler.

This is the error i'm getting. I looked at some other similar solutions wherein they stated to link react-native but those steps were for a previous version i guess.

enter image description here

This says that there's index in the react-native-gesture-handler but there is!!

Please help as i'm a newbie to react-native and such errors just demotivates


Solution

  • Try removing the apostrophe from your project name.

    Occasionally after installing, the Metro Bundler's file watcher appears to become desynchronized with the state of the node modules directly, or the cache can become corrupted.

    Try deleting your node_modules/ directory, reinstalling using yarn or npm i and then use:

    react-native start -- --reset-cache