I have been going through the react-native tutorial and ran
react-native init AwesomeApp as detailed in the FB page.
After many trials and errors in setting the correct permissions and path I was able to get the app running on IOS.
Awesome app is in a directory Projects
Now I want to create my own app in the same Projects folder and when I try
react-native init newApp I get
Looks like React Native project already exists in the current
folder. Run this command from a different folder or remove node_modules/react-native
I tried from a different folder and still get the same message.
What's the best way to resolve this, deleting the node_modules/react-native or is there another solution and why the same error in a different folder?
Had the same issue, the solution wasn't obvious and I find it nowhere on the Internet so I'm leaving it here.
You may have installed react-native
globally. While you should install react-native-cli
globally.
Having the first one installed makes typical react-native commads work (starting an app, linking native modules). The only difference is that init
fails with above message. And IIRC calling react-native
without arguments reveals the source of the problem with descriptive message that you've globally installed wrong package.
Edit:
On Windows also make sure to use CMD, not PowerShell. PowerShell was calling react-native
binary (instead of react-native-cli
) from SOMEWHERE (I don't know the source, I don't have it available globally, I removed every single globally installed package and it was still calling it (probably from some locally insalled copy)).
React Native development caused another issues too (can't remember the details, sorry) when used with Powershell, so just stick to CMD on Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With