In this article, you will learn how to install yarn on Ubuntu 20.04 LTS using the command line environment.
Note: Before starting the installation of yarn, you will install Node.js on your system and you should be logged in as root user on Ubuntu 20.04 LTS.
Installation of Yarn on Ubuntu 20.04 LTS
An official repository on Ubuntu 20.04 LTS is available for the installation yarn. Using the PPA method, you can install yarn globally on the system. In this way, every system user can access this yarn.
In order to install Yarn on your system, launch the Terminal using the Ctrl + Alt + t shortcut method and then you need to perform the following steps on the terminal:
Install CURL on Ubuntu 20.04 LTS
You can install CURL from the official package repository of Ubuntu 20.04 LTS. Execute the following command to install CURL on Ubuntu 20.04 LTS:
During the installation of the curl, it will notify you that extra system space will use to complete this operation. You will enter ‘y’ from your keyboard to proceed further.
Add GPG key
Once the Curl is successfully installed on your system, now, before the installation of yarn, you will add the GPG key to verify the yarn packages. To import GPG type the following command on the terminal:
Enable Yarn repository
To install yarn on your system, first, you will add and enable the yarn repository on Ubuntu 20.04 LTS. For this purpose, type the following command:
sudo tee /etc/apt/sources.list.d/yarn.list
Update cache and install Yarn on Ubuntu 20.04 LTS
In this step, first, you need to update the APT cache and then you will install yarn on Ubuntu 20.04 LTS using the following command:
After executing the above-mentioned command, first, it will update all system packages then it will install the new package manager yarn on your system. This command will install yarn from Ubuntu 20.04 LTS repositories.
The Node JS is dependent on Yarn. If currently, you are using Nodejs and NPM, then you will install Yarn by typing the following command on the terminal:
Check yarn version
Once the installation is finished on your system, after that, you will verify the installation of yarn that either it has been successfully installed on your system Ubuntu 20.04 or not. You will run the below-given command on the terminal:
After executing the above command on the terminal, you will see that the installed yarn version has displayed on your terminal window.
Congratulations! The yarn has been successfully installed on your system Ubuntu 20.04 LTS.
In this article, you have learned how you can install yarn on Ubuntu 20.04 LTS. Yarn is a good alternative to NPM that manages the dependencies of various web projects. So, if you are an experienced developer or in the learning phase then it becomes an essential part. Please give us your feedback via comments.
from Linux Hint https://ift.tt/3fu5zm9
0 Comments