React Native / Expo Environment Setup on Ubuntu

1. Install Node.js

Install Node.js from the official website using curl.

Example:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

Verify installation:

node -v
npm -v

2. Install npm (if not installed)

sudo apt install npm

3. Install Java (OpenJDK 17)

React Native requires Java for Android development.

sudo apt-get install openjdk-17-jdk
sudo apt-get install openjdk-17-jre

Verify:

java -version

4. Install Watchman

Watchman helps detect file changes for React Native projects.

sudo apt install watchman

Verify:

watchman --version

5. Install Android Studio

  1. Download Android Studio.

  2. Extract it into the root directory /.

Example:

sudo tar -xvf android-studio-*.tar.gz -C /

Navigate to the bin folder:

cd /android-studio/bin

Run Android Studio:

./studio.sh

Complete the Android SDK setup from the Android Studio wizard.


6. Configure Android Environment Variables

Open the .bashrc file:

gedit ~/.bashrc

Add the following lines at the end of the file:

export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin

Reference: React Native Environment Setup Guide


7. Reload Bash Configuration

Apply the changes:

source ~/.bashrc

8. Verify ADB (Android Debug Bridge)

Check if ADB is installed correctly.

adb --version

Expected Output:

Android Debug Bridge version 1.0.41

9. Install Required Global NPM Packages

Install Expo CLI and React Native CLI.

npm install -g expo-cli
npm install -g @react-native-community/cli

10. Start the React Native App

Navigate to your project folder.

Start the Expo development server:

npx expo start

Then:

  1. Install the Expo Go app on your Android device.

  2. Scan the Metro Bundler QR code shown in the terminal or browser.

  3. The app will run on your device.


Popular posts from this blog

MCSL 216 MCA NEW Practical ~ common questions suggestions

jitsi

Dev Cheatsheet