Setup for Windows

suggest change

Note: You cannot build React Native iOS apps on Windows, only Android apps.

The official Windows setup docs are here. A more detailed walkthrough is here.

Tools/Environment

1) Set up the machine for React Native development

Start the command line as an administrator and run:

choco install nodejs.install
choco install python2

Restart the command line as an administrator so you can run npm.

npm install -g react-native-cli

After that last command, copy the directory where react-native was installed. You will need it in the next step. On one machine that was C:\Program Files (x86)\Nodist\v-x64\6.2.2. On another it was C:\Users\admin\AppData\Roaming\npm.

2) Set your environment variables

A Step by Step guide with images can be found here for this section.

Open the Environment Variables window by navigating to:

[Right click] “Start” menu -> System -> Advanced System Settings -> Environment Variables

In the bottom section find the “Path” System Variable and add the location that react-native was installed to in step 1.

If you have not added an ANDROID_HOME environment variable, add it here too. While still in the Environment Variables window, add a system variable named ANDROID_HOME whose value is the path to your Android SDK.

Then restart the command line as an administrator so react-native is on the path.

3) Create your project

In the command line, go to the folder that should contain the project and run:

react-native init ProjectName

4) Run your project

Start an emulator from Android Studio. In the command line, go to the project root and run:

cd ProjectName
react-native run-android

You may run into dependency errors. For example, the build may say the build-tools version is missing. Open the SDK Manager in Android Studio and install that version.

Congrats!

To reload the UI, press r twice in the emulator while the app is running. For the developer menu, press Ctrl + M.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents