Ubuntu setup React Native
In this post, I am setting up React Native in Ubuntu 18.04. Before we begin, we need to check if we have all the prerequisites. Once all prerequisites are installed, we will proceed with setting up a React Native project. Finally running the app in Expo app in iOS and Android.
Java Development Kit (JDK)
Check your JDK version to see if you currently have JDK installed. In my screenshot, I do not have JDK installed.
# Check if you have JDK installed javac -version # Run the below command to install JDK sudo apt install openjdk-8-jdk-headless
Check your python version to see if you had python installed.
# Check your python version python -v # Run the below command to install python sudo apt install python
Node.js and npm
Check your Node.js and npm version to see if you had it installed.
# Check Node.js version node -v # Check npm version npm -v # Install Node.js sudo apt install nodejs # Install npm sudo apt install npm
Create React Native project
# This is for generating React Native project files sudo npm install -g create-react-native-app # Create a new project MyReactNativeApp sudo create-react-native-app MyReactNativeApp
Earlier we created the React Native project with sudo because it needs to write some files into /usr/local/ directory. Now we need to change the project files owner back to myself.
# Changeing the owner from root to myself cd ~ sudo chown -R kevinfoo:kevinfoo .expo/ sudo chown -R kevinfoo:kevinfoo MyReactNativeApp/
Running the app
cd MyReactNativeApp expo start
Expo client is available for download at their official site.