How to Install Yarn on Linux Mint 20

To Install Yarn On Linux Mint 20

Introduction:

The yarn is an advanced package management software for Node.js applications that is a fast, secure, and reliable alternative to any other Node.js package manager’s. I have installed the latest Node.js on Ubuntu and Debian systems. In this tutorial, we will cover the installation of the Yarn on Linux Mint 20.

Installation Procedure:

First check the version of the OS

root@LinuxHelp:~# cat /etc/os-release 
NAME="Linux Mint"
VERSION="20 (Ulyana)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20"
VERSION_ID="20"

Install the Yarn. Then enable the Yarn repository by using the following command

root@LinuxHelp:~# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
OK

Once the repository is enabled. Add the yarn repository to the system repository by using the following command

root@LinuxHelp:~# echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
deb https://dl.yarnpkg.com/debian/ stable main

The repository is added now update and install the yarn by using the following command

root@LinuxHelp:~# sudo apt-get update && sudo apt-get install yarn
Ign:1 http://packages.linuxmint.com ulyana InRelease                                                                    
Get:2 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]                                                          
Hit:3 http://packages.linuxmint.com ulyana Release                                                                     
Hit:5 http://archive.ubuntu.com/ubuntu focal InRelease                                                                 
.
.
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for doc-base (0.10.9) ...
Processing 1 added doc-base file...
Processing triggers for libc-bin (2.31-0ubuntu9) ...
Processing triggers for man-db (2.9.1-1) ...

The yarn is installed then install the packages of the yarn by using the following command

root@LinuxHelp:~# curl -o- -L https://yarnpkg.com/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    54  100    54    0     0     45      0  0:00:01  0:00:01 --:--:--    45
100  7152  100  7152    0     0   2672      0  0:00:02  0:00:02 --:--:-- 11020
Installing Yarn!
> Downloading tarball...
.
.
.
> We've added the following to your /root/.bashrc
> If this isn't the profile of your current shell then please add the following to your correct profile:
   
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

> Successfully installed Yarn 1.22.5! Please open another terminal where the `yarn` command will now be available.

Once the package is installed. Now check the version of yarn by using the following command

root@LinuxHelp:~# yarn -v
1.22.5

With this method, the installation of the Yarn on Linux Mint 20 comes to an end.

FAQ
Q
What is the command to check the version of Yarn?
A
The command is # yarn -v
Q
How do you install Yarn packages on Linux mint?
A
The command is # curl -o- -L https://yarnpkg.com/install.sh | bash
Q
How do you add the yarn repository to the system repository?
A
The command is # echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Q
How do you enable the Yarn Repository?
A
To enable the Yarn Repositor command use # curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
Q
What is Yarn software?
A
The 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’s.