So a while ago I deleted the /ios directory in my react native app (let\'s call it X). I\'ve been developing and testing using the android emulator but now I\'d like to make
This is too late, but for anyone who is still having same issue and have a detached react native app, what i did for me I just run exp detach over my detached app and it created ios folder!
Remove the ios folder first
react-native eject
cd ios/
pod init
pod install
cd ..
react-native link
cd ios
open *.xcworkspace/
Note as of react-native 0.60.x you can use the following to regenerate ios/android directories:
react-native upgrade --legacy true
Credit here: https://github.com/facebook/react-native/issues/25526
i faced the same issue in react native .63 version. I tried above all methods but didn't worked. So, I tried like this deleted android/ios folders in my old project tree and initiated a new project with similar name in another folder, later copied android/ios folders from new project to old project and reset cache using react-native start --reset-cache and run react-native run-android and my attempt was successfull.
❯ react-native eject
error Unrecognized command "eject". info Run "react-native --help" to see a list of all available commands.
❯ react-native upgrade --legacy true
error: unknown option `--legacy'
You can init a new project that's named the same in another folder and copy ios dir over:
inside YourProjectName directory
npx react-native init YourProjectName
mv YourProjectName/ios ios
rm -rf YourProjectName
Make sure you have clean git history before doing so, in case you need to revert
Simply remove/delete android and ios (keep backup android and ios folder) and run following command:
react-native eject
Supported version :
react-native <= 0.59.10
react-native-cli <= 1.3.0
react-native upgrade --legacy true
Supported version :
react-native >= 0.60.0
react-native-cli >= 2.1.0
Ref : link