A Beginner’s Guide to Clean Installation of React Native on Windows (With Fixes to Common Errors)

Mausumi NandaMausumi Nanda
2 min read

If you’re a beginner struggling to set up a React Native environment on a Windows machine, you’re not alone. In this guide, I’ll walk you through the correct way to install React Native from scratch and provide fixes to common errors I personally encountered.


🛠️ Prerequisites

  1. Node.js: Install the latest LTS version from nodejs.org

  2. Java Development Kit (JDK): Install JDK 17 or higher.

  3. Android Studio: Install it from developer.android.com

  4. Expo CLI (optional): npm install -g expo-cli


🌀 Initializing the React Native Project

npx react-native init MyAwesomeApp
cd MyAwesomeApp

📂 File and Folder Structure (Important)

Ensure you always run commands like npx react-native run-android from the project root folder, not the /android subfolder. Running it from the wrong folder may lead to partial builds or emulator failures.


💣 Common Errors & Their Fixes

❌ Error 1: NDK did not have a source.properties file

Cause:

You installed an NDK manually or through Android Studio that’s broken or incomplete.

Solution:

  1. Open Android Studio → Appearance & Behavior → System Settings → Android SDK → SDK Tools

  2. Select NDK (Side by side) and choose version: 25.2.9519653

  3. Delete broken NDK folders, e.g.

     C:\Users\YourUsername\AppData\Local\Android\Sdk\ndk\27.1.12297006
    

Keep only the stable one.


❌ Error 2: ./gradlew

.\gradlew clean

Make sure you're inside the /android directory.


❌ Error 3: Failed to launch emulator

Cause:

React Native CLI couldn’t auto-launch the emulator.

Solution:

Manually start the emulator:

"C:\Users\YourUsername\AppData\Local\Android\Sdk\emulator\emulator.exe" @Your_AVD_Name

Then re-run:

npx react-native run-android

❌ Error 4: Missing local.properties file

Solution:

Inside /android folder, create a file named local.properties and add:

sdk.dir=C:\Users\YourUsername\AppData\Local\Android\Sdk

Replace YourUsername with your actual Windows username.


🔁 Want a Clean Slate? How to Restart From Scratch

  1. Delete your entire React Native project folder:

     rm -rf MyAwesomeApp
    
  2. Delete Gradle cache:

     C:\Users\YourUsername\.gradle
    
  3. Reinstall:

     npx react-native init MyAwesomeApp
     cd MyAwesomeApp
     npx react-native run-android
    

0
Subscribe to my newsletter

Read articles from Mausumi Nanda directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mausumi Nanda
Mausumi Nanda