install reactjs in ubuntu

How to Install ReactJS in Ubuntu

ReactJS is a popular Javascript framework that allows you to easily develop interactive user interfaces for your websites and applications. In this article, we will look at how to install ReactJS in Ubuntu.


How to Install ReactJS in Ubuntu

Here are the steps to install ReactJS in Ubuntu. We will use NPM package manager, useful for managing Javascript packages.


1. Install NPM

Open terminal and run the following command to install NPM.

$ sudo apt install npm

Check NPM version

$ sudo npm -v
6.14.2

NPM will also install NodeJS a web server and development platform for JS applications. You can check its version with the following command.

$ sudo node -v

Also read : How to Create JSON Response in Django


2. Install create-react-app utility

create-react-app utility that allows you to install and setup all necessary tools required to develop ReactJS applications. Run the following command to install this utility.

$ sudo npm -g install create-react-app

After its installation, you check its version using the following command.

$ create-react-app --version

Also read : How to Run Shell Script in Linux


3. Create & Launch Your First ReactJS Application

It is very easy to create & launch an app in ReactJS. Just run the following command to create your first ReactJS app sample-app. You can change its name as per your requirement.

$ create-react-app sample-app

It takes 2-3 minutes to create the application, with all its dependencies. Once the application is created you will see the following message

Success! Created sample-app at /home/ubuntu/sample-app
...

To run the application, go to the directory.

$ cd /home/ubuntu/sample-app

and run the command

$ sudo npm start

You will see the following output.

Also read : How to Rename Multiple Files in Linux


4. Test your application

ReactJS application runs on port 3000. Open web browser and go to http://server-ip:3000

You will see the following screen.

In this article, we have learnt how to install ReactJS in Ubuntu.

Also read : How to Extract .bz2 file in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *