How To Install Yarn On Linux Mint 20.2

To Install Yarn On Linux Mint 20.2

Introduction :

Yarn is a package manager for your code. It allows you to use and share (e.g. JavaScript) code with other developers from around the world. ... Yarn allows you to use other developers' solutions to different problems, making it easier for you to develop your software.

Installation procedure :

Step 1 : Check the OS version by using the below command

root@linuxhelp:~# cat /etc/os-release 

NAME="Linux Mint"
VERSION="20.2 (Uma)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20.2"
VERSION_ID="20.2"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=uma
UBUNTU_CODENAME=focal

Step 2 : Add the gpg key y using the below command

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

Step 3 : Update the source list by using the below 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

Step 4 : Update and install yarn y using the below command

root@linuxhelp:~# apt-get update && apt-get install yarn

Get:1 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main all Packages [10.5 kB]           
Hit:7 http://security.ubuntu.com/ubuntu focal-security InRelease                 
Hit:8 http://packages.linuxmint.com uma Release                                  
Hit:9 http://archive.ubuntu.com/ubuntu focal InRelease                     
Hit:11 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:12 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Fetched 48.7 kB in 1s (36.1 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libnode64 nodejs nodejs-doc

Step 5 : Install the yarn package y using the below URL

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    53  100    53    0     0    234      0 --:--:-- --:--:-- --:--:--   234
100  7152  100  7152    0     0  15928      0 --:--:-- --:--:-- --:--:-- 96648
Installing Yarn!
> Downloading tarball...
> GPG signature looks good
> Extracting to ~/.yarn...
> Adding to $PATH...
> 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.17! Please open another terminal where the `yarn` command will now be available.

Step 6 : Check the version of yarn by using the below command

root@linuxhelp:~# yarn -v
1.22.17

With this, the process of installing yarn on linux mint 20.2 has come to an end.

FAQ
Q
What is the command to check the version of Yarn?
A
The command to check the version of Yarn is # yarn -v
Q
How do you install Yarn packages on Linux mint?
A
To install Yarn packages on Linux mint use the command # curl -o- -L https://yarnpkg.com/install.sh | bash
Q
How do you add the yarn repository to the system repository?
A
To add the yarn repository to the system repository use the command # 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 Repository to use the command # 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.