How to install React Native in Linux (pop OS)

How to install React Native in Linux (pop OS)

Download VS Code and JDK

VS Code

I would recommend to install it as .deb package from official website

https://code.visualstudio.com/download

-To install the .deb package just double click and the "Eddy" (Package Installer for Linux) will handle the rest

JDK

Similarly install the .deb package for JDK to from official website

https://www.oracle.com/java/technologies/downloads

-Eddy will handle it or you can use the following command:

sudo dpkg -i yourPackageFile.deb

Also Install ADB tools :

sudo apt install adb

Now Create a new folder on desktop or whereever you prefer

-run the following command and check the if everything is intsalled

To Check if JDK is installed properly

java --version

Output:
java 21.0.2 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing)

Now just run the command on terminal sequence wise:

$ npx react-native@latest init MyFirstProject 
$ cd MyFirstProject
$ npx react-native start
then press "a" to run on android

Tips

  • Make sure you have enabled USB debugging on android and it is properly connected to port via USB cable

  • Check using the command on terminal if your device is connected properly

    "adb devices"

  • There might be an possible err that you might face that is not having adb device configured on your pc and the "npx react-native start" might throw and err as adb could not found or something like that

  • To solve this err you need to open the MyFirstProject

  • Then go to MyFirstProject/android and create a new file as local.properties

  • Now ADD this command in that file and save

      sdk.dir=/home/YourPC-Name/Android/Sdk
    

-make sure you replace it with your pc name