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:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image7-23.png" data-lazy- height="302" src="data:image/svg xml,” width=”811″>

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:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image9-18.png" data-lazy- height="165" src="data:image/svg xml,” width=”810″>

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 https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image8-20.png" data-lazy- height="109" src="data:image/svg xml,” width=”815″>

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 https://dl.yarnpkg.com/debian/ stable main” |

sudo tee /etc/apt/sources.list.d/yarn.list

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image11-14.png" data-lazy- height="111" src="data:image/svg xml,” width=”813″>

Step 5: Install Yarn

First, update the apt cache before installing Yarn:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image10-18.png" data-lazy- height="370" src="data:image/svg xml,” width=”805″>

Next, install Yarn using the following command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image2-31.png" data-lazy- height="262" src="data:image/svg xml,” width=”808″>

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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image1-32.png" data-lazy- height="78" src="data:image/svg xml,” width=”805″>

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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image4-27.png" data-lazy- height="129" src="data:image/svg xml,” width=”807″>

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:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image3-29.png" data-lazy- height="88" src="data:image/svg xml,” width=”811″>

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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image6-23.png" data-lazy- height="219" src="data:image/svg xml,” width=”812″>

Press ‘y’ to continue removing Yarn.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/image5-25.png" data-lazy- height="72" src="data:image/svg xml,” width=”814″>

Conclusion

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

<img alt="Kamran Sattar Awaisi" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/52E439DD556343299E3D211D5E577D28-150×150.jpg603d9a7e373f0.jpg" height="112" src="data:image/svg xml,” width=”112″>

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.