Linux Mint

How to Install Yarn on Linux Mint 20

Yarn is a JavaScript package and dependency management tool that helps users to automate the tasks of installing, updating, removing, and configuring NPM packages. Yarn is an open-source package manager that saves a lot of time for JavaScript programmers because it creates a cache of downloaded packages. Using Yarn, a programmer can easily access and re-use a package without re-downloading it every time.

This article shows you how to install Yarn on Linux Mint 20.

Installing Yarn on Linux Mint 20

The Yarn tool is not included in Linux Mint 20 standard repositories. However, Yarn can be installed by adding the official repository of Yarn. To install Yarn from the official repository, fire up the terminal, and follow the steps provided below:

Step 1: Update APT Cache

As always, first, update the apt cache with the following command:

$ sudo apt update

Step 2: Install Curl

The Curl command is required to fetch Yarn’s GPG key. Curl comes pre-installed on Linux Mint 20. However, if Curl is not installed on your system, then install it with the following command:

$ sudo apt install curl

Step 3: Import GPG Key of Yarn Repository

After the successful installation of Curl, import the Yarn repository’s GPG key using the command given below:

$ curl -sS | sudo apt-key add -

The ‘OK’ confirms that the GPG key has been imported successfully.

Step 4: Add Yarn Repository

Once the GPG key has been imported, add the Yarn repository. The following command will add and enable the Yarn repository:

$ echo "deb stable main" |
sudo tee /etc/apt/sources.list.d/yarn.list

Step 5: Install Yarn

First, update the apt cache before installing Yarn:

$ sudo apt update

Next, install Yarn using the following command:

$ sudo apt install yarn

Yarn requires 36.0 MB of additional disk space. If you agree to this, press ‘y’ to continue installing Yarn.

The above command will also install NodeJS. If you have already installed NodeJS, then skip the above command, and install Yarn with the command given below:

$ sudo apt install --no-install-recommends yarn

Step 6: Check Installed Version of Yarn

Once Yarn has been installed successfully, verify the installation and check the installed version with the following command:

$ yarn --version

The output above shows that Yarn version 1.22.5 has been installed successfully on the Linux Mint 20 system.

How to Remove Yarn from Linux Mint 20

If you no longer require Yarn and want to remove it from your Linux Mint 20 system, then it is very easy and straightforward to remove.

Issue the following command in the terminal to remove Yarn completely from your system:

$ sudo apt remove--autoremove yarn

Press ‘y’ to continue removing Yarn.


This article showed you how to install Yarn on Linux Mint 20. The article also showed you how to remove Yarn completely from your system. You can manage NPM packages very easily and efficiently using Yarn. Yarn’s repository is regularly maintained by the developers and contains the latest stable version.

About the author

Kamran Sattar Awaisi

I am a software engineer and a research scholar. I like to write article and make tutorial on various IT topics including Python, Cloud Computing, Fog Computing and Deep Learning. I love to use Linux based operating systems.