Topic 3 of 15 · React Native

Topic 3 : Windows Installation

Lesson TL;DRTopic 3: Windows Installation 📖 5 min read · 🎯 beginner · 🧭 Prerequisites: introduction, macinstallation Why this matters Before you write a single line of React Native code, your Windows machine n...
5 min read·beginner·react-native · windows · android-studio · chocolatey

Topic 3: Windows Installation

📖 5 min read · 🎯 beginner · 🧭 Prerequisites: introduction, mac-installation

Why this matters

Before you write a single line of React Native code, your Windows machine needs to be set up to understand it. Node, Java, the Android SDK, a package manager — each one plays a role, and if any piece is missing or mismatched, nothing runs. I know this step feels like it's getting in the way of the "real learning," but here's the truth: get this right once, and every project you build from here starts on solid ground. Let's walk through it together, step by step.

What You'll Learn

  • Install the required prerequisites: Node.js, Python, and the Java Development Kit
  • Use Chocolatey as a Windows package manager to streamline tooling
  • Configure Android Studio and set the necessary environment variables
  • Create and run a new React Native project on an Android emulator

The Analogy

Think of your Windows machine as a construction site before a single brick is laid. Node.js is the foreman who coordinates all the work; Python is the surveyor who handles behind-the-scenes measurements; the JDK is the blueprint printer that translates your React Native plans into something Android can read; Android Studio is the on-site crane — big, powerful, and absolutely necessary for lifting apps onto an emulator. Chocolatey is the supply truck that delivers all these tools to the site in one trip so you are not running to the hardware store for each one separately. Set up the site correctly, and every build after this is smooth.

Chapter 1: Prerequisites

Three tools must be on your machine before anything else works. Install them in order.

  1. Node.js — Download and install from nodejs.org. Choose the LTS release for stability.
  2. Python — Download and install from python.org. The React Native build toolchain relies on Python scripts internally.
  3. Java Development Kit (JDK) — Download and install from AdoptOpenJDK. The Android build system is Java-based, so the JDK is non-negotiable.

Verify each installation by opening PowerShell and running:

node --version
python --version
java -version

All three commands should return version strings without errors before you continue.

Chapter 2: Installing Chocolatey

Chocolatey is a package manager for Windows — the Windows equivalent of brew on macOS. It lets you install and update developer tools from the command line instead of hunting down installers manually.

Step 1: Install Chocolatey

Open PowerShell as an Administrator (right-click the Start menu → "Windows PowerShell (Admin)") and run:

Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = `
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

After the script completes, close and reopen PowerShell (still as Administrator) and verify:

choco --version

A version number confirms Chocolatey is ready to use.

Chapter 3: Installing Android Studio

Android Studio provides the Android SDK, the emulator, and the build tools that react-native run-android depends on.

Step 1: Install Android Studio

Download and install Android Studio from developer.android.com/studio. During installation, make sure the following components are selected:

  • Android SDK
  • Android SDK Platform-Tools
  • Android SDK Build-Tools

Step 2: Configure the Android SDK

  1. Open Android Studio.
  2. Navigate to File → Settings → Appearance & Behavior → System Settings → Android SDK.
  3. Confirm that the required SDK platforms and tools are installed. Install any missing items from this panel.

Step 3: Set Up Environment Variables

React Native's build toolchain needs to know where the Android SDK lives. Set the ANDROID_HOME environment variable:

  1. Open the Start Search, type env, and select "Edit the system environment variables".
  2. In the System Properties window, click "Environment Variables".
  3. Under "System variables", click "New".
  4. Set the variable name to ANDROID_HOME and the variable value to your SDK location, for example:
C:\Users\<Your-Username>\AppData\Local\Android\Sdk

Next, add the following entries to the Path system variable (select PathEditNew for each):

%ANDROID_HOME%\tools
%ANDROID_HOME%\tools\bin
%ANDROID_HOME%\platform-tools

Close and reopen any terminal windows so the new variables take effect.

Chapter 4: Installing React Native CLI

The React Native CLI is the command-line tool that scaffolds new projects and manages builds.

Step 1: Install React Native CLI globally

npm install -g react-native-cli

Verify the installation:

react-native --version

Chapter 5: Creating a New React Native Project

With the environment fully wired up, the class creates their first project.

Step 1: Create a new project

npx react-native init MyFirstApp

This command bootstraps a complete React Native project in a folder called MyFirstApp, including all native Android (and iOS) project files.

Step 2: Navigate to the project directory

cd MyFirstApp

All subsequent commands must be run from inside this directory.

Chapter 6: Running the App on an Android Emulator

Step 1: Start the Android Emulator

  1. Open Android Studio.
  2. Go to Tools → AVD Manager.
  3. Click the Play button next to your created Android Virtual Device (AVD) to launch the emulator. Wait until the emulator fully boots to the Android home screen.

Step 2: Run the React Native app

With the emulator running, open a terminal inside MyFirstApp and execute:

npx react-native run-android

React Native will compile the JavaScript bundle and install the debug APK on the emulator. The app appears on-screen when the build succeeds.

Chapter 7: iOS Simulator on Windows (Optional)

Running iOS apps natively on Windows is not officially supported — Apple's toolchain (Xcode, the iOS Simulator) requires macOS. If you need to test iOS builds from a Windows machine, two cloud-based options work well:

  • Expo — a managed workflow that lets you preview your app on a physical iOS device via the Expo Go app, no Mac required.
  • Appetize.io — a browser-based iOS and Android emulator that streams a real device to your browser.

For full native iOS development, a macOS machine remains the recommended path (see the Mac Installation lesson).

🧪 Try It Yourself

Task: Bootstrap a React Native project called CouncilApp and confirm it runs on your Android emulator.

  1. Run the scaffold command:
npx react-native init CouncilApp
  1. Move into the project folder:
cd CouncilApp
  1. Start your AVD from Android Studio's AVD Manager, then run:
npx react-native run-android

Success criterion: The emulator displays the default React Native welcome screen with the text "Welcome to React Native" and instructions to edit App.js. If you see that screen, your Windows environment is fully operational.

🔍 Checkpoint Quiz

Q1. Why must you set the ANDROID_HOME environment variable during React Native setup on Windows?

A) It tells Node.js where to find npm packages
B) It lets the React Native build toolchain locate the Android SDK
C) It is required by Python for build scripts
D) It configures the default emulator screen size

Q2. Given the following PowerShell snippet used during setup, what does the final line (iex (...)) do?

Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = `
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

A) Downloads and immediately executes the Chocolatey install script
B) Installs Node.js from the Chocolatey registry
C) Sets a permanent execution policy for all PowerShell sessions
D) Verifies the Chocolatey checksum before installing

Q3. A developer runs npx react-native run-android but gets an error saying the Android SDK cannot be found. Which of the following is the most likely cause?

A) React Native CLI was not installed globally
B) The ANDROID_HOME environment variable is missing or points to the wrong path
C) Node.js is the wrong version
D) The emulator was started before the terminal was opened

Q4. Which three paths must be added to the Windows Path variable for Android tools to be accessible from the terminal?

A) %ANDROID_HOME%\tools, %ANDROID_HOME%\tools\bin, %ANDROID_HOME%\platform-tools
B) %ANDROID_HOME%\sdk, %ANDROID_HOME%\build, %ANDROID_HOME%\emulator
C) %JAVA_HOME%\bin, %NODE_HOME%\bin, %ANDROID_HOME%\tools
D) %ANDROID_HOME%\gradle, %ANDROID_HOME%\tools, %ANDROID_HOME%\ndk

A1. B — The ANDROID_HOME variable tells the React Native Android build toolchain (gradle, build scripts) exactly where the SDK is installed; without it, builds fail immediately.

A2. A — iex is PowerShell's Invoke-Expression. It downloads the Chocolatey install script as a string and executes it in the current session. The preceding lines raise the security protocol version and bypass the process-scoped execution policy so the remote script is permitted to run.

A3. B — react-native run-android reads ANDROID_HOME to locate adb, build tools, and the SDK platforms. A missing or incorrect variable is the most common cause of this error on Windows.

A4. A — %ANDROID_HOME%\tools, %ANDROID_HOME%\tools\bin, and %ANDROID_HOME%\platform-tools expose android, sdkmanager, and adb respectively to any terminal session.

🪞 Recap

  • Node.js, Python, and the JDK are mandatory prerequisites before any React Native tooling can function on Windows.
  • Chocolatey simplifies installing and managing Windows developer tools from an elevated PowerShell session.
  • Android Studio provides the SDK, Platform-Tools, and Build-Tools; the ANDROID_HOME variable and three Path entries wire these into the build pipeline.
  • npx react-native init <ProjectName> scaffolds a new project; npx react-native run-android compiles and deploys it to a running Android emulator.
  • Native iOS development on Windows is unsupported; Expo and Appetize.io are the practical cloud-based alternatives.

📚 Further Reading

Like this topic? It’s one of 15 in React Native.

Block your seat for ₹2,500 and join the next cohort.