📌  相关文章
📜  react native ubuntu 20.04 - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:19:43.889000             🧑  作者: Mango

React Native Ubuntu 20.04 - Shell/Bash

Introduction

React Native is a framework for building mobile applications using JavaScript and React. It allows developers to write code once and deploy it on both iOS and Android platforms. In this tutorial, we will cover the installation process of React Native on Ubuntu 20.04 using the Shell/Bash terminal.

Prerequisites

Before proceeding further, make sure you have the following prerequisites:

  • Ubuntu 20.04 installed on the system
  • A user account with sudo privileges
  • Basic knowledge of the terminal commands and Bash script
Installation

Here, we will install the latest version of React Native via the terminal. Follow the given steps to install React Native on Ubuntu 20.04:

Step 1: Install Node.js and npm

To install React Native, we need to install Node.js and npm first. To do this, run the following command:

sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
Step 2: Install Java Development Kit

React Native requires Java Development Kit (JDK) for some of its features. To install the JDK, run the following command:

sudo apt-get install openjdk-8-jdk
Step 3: Install Android Studio

We also need to install Android Studio, which is a development environment for Android app development. To install Android Studio, run the following command:

sudo snap install android-studio --classic
Step 4: Setup Environment Variables

After the installation of the above packages, we need to set up some environment variables for successful operation. To set up the variables, run the following command:

echo "export ANDROID_HOME=$HOME/Android/Sdk" >> ~/.bashrc
echo "export PATH=$PATH:$ANDROID_HOME/tools" >> ~/.bashrc
echo "export PATH=$PATH:$ANDROID_HOME/platform-tools" >> ~/.bashrc
Step 5: Install React Native CLI

Finally, we can install the React Native CLI using the npm package manager. To install it, run the following command:

sudo npm install -g react-native-cli
Conclusion

In this tutorial, we have covered the installation process of React Native on Ubuntu 20.04 using the Shell/Bash terminal. We first installed Node.js and npm, followed by the installation of the Java Development Kit and Android Studio. After that, we set up the environment variables and then installed the React Native CLI using npm. Now, you can start developing mobile applications using React Native on Ubuntu 20.04.