Help! Unable to Set-Up React-Native for Android

I had started set-up for creating react-native for android by using the standard documentation.

I installed Watchman and Node through Homebrew, like the docs recommend.

I installed Android Studio and created a .bash_profile config file to put the Android specific environment variables. At this point, I tried to run the command ‘react-native init AwesomeProject’ to create my react-native app and I got back the response: ‘react-native’: command not found.

I looked on stack overflow for answers, and they discussed changing the path of the different npm package environment variables.

I tried changing around all of them, but continued to get the same result. I don’t know if it makes a difference, but I added all of these environment variables to my .bash_profile file, and I don’t know if they have to be in separate files, or in the .bashrc file or whatnot.

Basically, I’m trying to figure out how to start the react-native app for android, when after I do ‘npm install -g react-native-cli’ and ‘react-native init AwesomeApp’, I continually get ‘react-native: command not found’.

https://facebook.github.io/react-native/docs/getting-started

Have you tried the expo-cli option? I’m on Ubuntu and it made starting using react native fairly easy.

expo is an option. There’s also create-react-native-app. There are others.

I’m no expert, but…

But back to react-native-cli - what happens when you type: react-native --version?

Uninstall the react-native-cli package with:

$ [sudo] npm -uninstall -g react-native-cli

Then reinstall with:

$ [sudo] npm -install -g react-native-cli

What is the string that it returns? Save that. Compare it to the output of:

$ echo $PATH

If the path returned when you installed react-native-cli was something like /the/path/to/npm/bin/react-native, I think everything up to and including the bin should be somewhere in the path.

I will say that setting up react native was very difficult. It took a few weeks to get everything right, especially the Android and Java stuff. But I stuck with it and I’m glad I did - React Native is fun and it landed my a job.

If you can’t get it to work, one option is to just use npx react-native-cli instead of react-native. Note that this will take longer for every command you execute on it, beacuse it sort of has to temporarily install the react-native-cli package, and then use it. But it doesn’t take long to install it. :smiley:

Thanks for the replies, guys. I was able to get it resolved and wrote an answer for someone having a similar issue. htt ps://stackoverflow.com/questions/50481628/i-cant-create-a-react-native-project/55960952#55960952