Cli: How can I regenerate ios folder in React Native project?

Created on 17 Oct 2019  ยท  13Comments  ยท  Source: react-native-community/cli

Ask your Question

How can I regenerate ios folder in React Native project?

react-native-cli: 2.0.1
react-native: 0.61.2

โฏ 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'

question

Most helpful comment

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

All 13 comments

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

thanks

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

Omg, Why do that?, Can't we use "react-native upgrade --legacy true or react-native eject"?

think there should be an command like eject

@socialty If you feel like it, please create a detailed feature request with a motivation for why it's worth to spend time implementing such a feature, when you can do so manually without too much hassle (no great DX, but possible).

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

Omg, Why do that?, Can't we use "react-native upgrade --legacy true or react-native eject"?

It appears the latest version of react native got rid of those commands :(

think there should be an command like eject

As above react-native version, it seems like have been removed

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

thanks... I was getting crazy. Is this the only way? really??!!

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

Although not ideal, seems to be the best option for now. Thanks!

Add command to regenerate iOS or Android file incase of a mess up

Command already existed in previous versions of RN, but has been removed.

I solve this on ubuntu 20.04 running:
sudo npx react-native run-android

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

This one is great option!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ferrannp picture ferrannp  ยท  4Comments

ctavan picture ctavan  ยท  3Comments

tallpants picture tallpants  ยท  4Comments

sibelius picture sibelius  ยท  3Comments

mauricioscotton picture mauricioscotton  ยท  3Comments