There are various problems that cause this problem. I will post here what I did to solve in my case.
1 - Delete the node_modules folder and the android and ios folders from the project root:
rm -rf node_modules/ ios/ android/
2 - Rebuild folders:
npm install && react-native upgrade
or (if you used yarn in the project)
yarn install && react-native upgrade
3 - After that, just run the command again:
react-native run-ios
or
react-native run-android.
Hope this helped =)
Carlos Eduardo da Silva
source share