📅  最后修改于: 2023-12-03 15:19:43.889000             🧑  作者: Mango
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.
Before proceeding further, make sure you have the following prerequisites:
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:
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
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
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
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
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
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.