Install Yarn on Ubuntu 20.04 LTS - A step by step guide ?

Yarn is an advanced package management software for Node.js applications. It is a fast, secure, and reliable alternative that any other Nodejs package manager.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux system Software Installation queries.

In this context, we shall look into how to install Yarn on Ubuntu 20.04 LTS. 

Steps to install Yarn on Ubuntu 20.04 LTS Focal Fossa 

1.  Perform system update

First, make sure that all your system packages are up-to-date by running these following apt commands in the terminal:

$ sudo apt update
$ sudo apt upgrade

2. Install Yarn on the system

Now we enable the official Yarn repository also import the repository GPG key:

$ curl -sS | sudo apt-key add -
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Then, you will install Yarn on Ubuntu 20.04 LTS using the following command:

$ sudo apt update
$ sudo apt install yarn

How to Verify Yarn installation ?

To do this, simply run the below command:

$ yarn --version

How to use Yarn ?

You can Create a new Yarn project use yarn init:

$ yarn init my_yarn_project

Then add dependency:

$ yarn add [package_name] 

You can upgrade dependency, run:

$ yarn upgrade [package_name]
$ yarn upgrade [package_name]@[version_or_tag]

Finally to install all project dependencies:

$ yarn

[Need help in installing any Software on your Linux system ? We can help you. ]

This article covers how to install Yarn on your Ubuntu 20.04 LTS Focal Fossa. In fact, Yarn is a tool for managing, updating, and sharing your Java code. Yarn works through node.js helping to track libraries, dependencies, and even enables you to share solutions with other developers. 

For additional help or useful information, we recommend you to check the official Yarn website.

Related Posts