Wednesday, February 6, 2019

Regenerate ios and android folder in React Native project

Regenerate ios and android folder in React Native project


I get an error saying: "Error: Couldn't 

find preset module:metro-react-native-babel-preset relative to directory /<my path to the project>. 

solutions:
I've had this issue. Remove everything in .babelrc 
# .babelrc


Then run react-native-git-upgrade and then add the contents of .babelrc back




upgrade from RN 0.57 to 0.58. I am calling react-native-git-upgrade.


I deleted the ios and android directory in my react native app

First copy the directory which your to-be-name-changed application exists. And go to your newly cloned directory.

Change the name at index.ios/android.js file which is given as a parameter to AppRegistry.

Change the name and version accordingly on package.json

Delete /ios and /android folders which are remaining from your older app.

Run $react-native upgrade to generate /ios and /android folders again.

Run $react-native link for any native dependency.

Finally run $react-native run-ios or anything you want.

windows user

react-native upgrade //rebuilds android/ios folders
react-native link
react-native run-android

react-native run-ios


Note


The reason I use react-native upgrade is just to re-generate /ios and /android project folders. 
It does not changes/updates/upgrades react native version 
However I see that react-native-git-upgrade is more appropriate if you want to change the react native version of your project.


















No comments:

Post a Comment