0

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

Mi8Guy
  • 37
  • 9
  • Try removing the apostrophe from your project name. – Mapsy Aug 09 '20 at 15:10
  • Try deleting your `node_modules` directory, reinstalling using `yarn` or `npm i` then use `react-native start -- --reset-cache` – Mapsy Aug 09 '20 at 15:12
  • okay now it builds without error, but why did it happen? – Mi8Guy Aug 09 '20 at 15:30
  • It just happens occasionally. I think the file watching gets confused. It has just become habit now; whenever I've just installed something and get this error, I check to see it's entry in my `package.json`. If it's there, then it means either Metro is confused or my import statement is wrong. (Unless of coursee the library is importing something incorrectly) – Mapsy Aug 10 '20 at 09:17

1 Answers1

1

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
Mapsy
  • 4,192
  • 1
  • 37
  • 43