0
0
React Nativemobile~10 mins

Environment setup (Node, Watchman, Xcode, Android Studio) in React Native

Choose your learning style9 modes available
Introduction

Setting up your environment means installing the tools you need to build and run mobile apps. This helps your computer understand and run your app code.

When you want to start making a new React Native app on your computer.
When you need to run your app on an iPhone or Android phone for testing.
When you want to fix errors caused by missing tools or wrong versions.
When you want to update your tools to the latest versions for better features.
Syntax
React Native
1. Install Node.js from https://nodejs.org/
2. Install Watchman (macOS only) using Homebrew: brew install watchman
3. Install Xcode from the Mac App Store (for iOS development)
4. Install Android Studio from https://developer.android.com/studio
5. Set up Android SDK and emulator inside Android Studio
6. Configure environment variables for Android SDK
7. Verify installations by running commands like node -v, watchman -v, xcodebuild -version, and adb version

Node.js lets you run JavaScript code on your computer outside the browser.

Watchman helps watch for file changes to speed up app reloads during development.

Examples
Check if Node.js is installed and see its version.
React Native
node -v
Check if Watchman is installed (macOS only).
React Native
watchman -v
Check your Xcode version to confirm installation.
React Native
xcodebuild -version
Check if Android Debug Bridge (ADB) is installed and working.
React Native
adb version
Sample App

This simple React Native app shows a message confirming your environment is ready. You can run this app on your phone or emulator to check your setup.

React Native
import React from 'react';
import { Text, View } from 'react-native';

export default function App() {
  return (
    <View style={{flex:1, justifyContent:'center', alignItems:'center'}}>
      <Text>Environment Setup Complete!</Text>
    </View>
  );
}
OutputSuccess
Important Notes

Make sure to restart your terminal or computer after installing tools to update system paths.

For iOS development, Xcode only works on macOS.

Android Studio setup requires downloading SDKs and creating virtual devices (emulators) for testing.

Summary

Install Node.js to run JavaScript on your computer.

Use Watchman on macOS to watch file changes faster.

Install Xcode for iOS apps and Android Studio for Android apps.

Verify each tool by checking its version in the terminal.