Sep 27, 2023 5 min read

How to Install Yarn on Debian 10

Install Yarn on Debian 10 with our step-by-step tutorial. Yarn, proposed by Facebook, is a package manager addressing npm's limitations.

Install Yarn on Debian 10
Table of Contents

Choose a different version or distribution


Before we start talking on how to install Yarn on Debian 10, let's briefly understand - What is Yarn?

Yarn, which stands for Yet Another Resource Negotiator, is a package manager that was first proposed by Facebook to address npm's inadequacies.

Yarn is a package manager for Node.js that provides a fast and reliable installation process. It is designed to optimize package fetching and supports parallel installations, making it popular among developers.

In this tutorial, you will install Yarn on Debian 10. We will also address a few FAQs on how to install Yarn on Debian 10.

Advantages of Yarn

  1. Fast and Parallel Installations: Yarn optimizes package installations for improved performance by utilizing parallel execution and caching.
  2. Reliable Dependency Resolution: Yarn ensures consistent and deterministic dependency resolution, providing reliable installations across different environments.
  3. Offline Mode Support: Yarn offers offline mode, allowing developers to work in disconnected environments without compromising package installations.
  4. Automatic Lock File Management: Yarn automatically creates and updates a lock file (yarn.lock) to prevent dependency conflicts and ensure consistent installations.
  5. Large Ecosystem and Community: Yarn benefits from a large ecosystem of packages and an active community that contributes to its development, ensuring ongoing improvements and support.

Distinctive Qualities of yarn

The following list of distinctive qualities of the yarn package manager is provided:

  • Speed: Yarn uses a parallel installation strategy, which speeds up and improves the performance of the package by installing packages parallelly. While npm will finish installing one package before going on to the next, performance latency is experienced in this circumstance.
  • Security: Yarn uses a cryptographic hashing mechanism to make sure that packages are installed securely.
  • Log: The majority of package managers strive to deliver a readable output, however, their output interfaces vary. Yarn does support producing output that is clear and readable.
  • Information about dependencies: Yarn, which was created to address npm's deficiencies, supports the "why" command, which explains the rationale for any dependency's existence.
  • Lock file: To assist in maintaining the project dependencies, yarn creates "yarn.lock" files each time a module is introduced.

How to Install Yarn on Debian 10

There are three popular ways to install yarn on Debian 10:

  • Using npm
  • Using PPA command
  • Using script

This section's main body will outline a step-by-step process for installing Yarn on a Debian 10 system:


Several pre-installed packages are necessary for every installation; For instance, in order to obtain yarn, your system needs the following packages:

  • Curl: In Method 2, this command-line tool will be used to import the GPG key, and in Method 3, it will be used to download the yarn script.
  • Node Package Manager(npm): Before installing yarn, npm must be installed on your Debian 10.
  • Node.js: As previously stated, Node.js is a prerequisite for installing npm, which is necessary for installing yarn.

Installing yarn using npm on Debian 10

To make this installation tutorial easier to grasp, let's break it down into a number of steps:

Step 1: Update and Upgrade

By using the command listed below, you can update the Debian 10 system repository:

sudo apt update 

Step 2: Install Node.js

Node.js is pre-installed on the Debian 10 repository, thus running the command listed below will allow you to install it:

sudo apt install nodejs npm 

It is noted that npm is also installed.

To check the Node.js version:

node -v

And for npm:

npm -v

Step 3: Install yarn using npm

Once all necessary prerequisites have been met, run the following command to install yarn using npm:

sudo npm install --global yarn 

Installing yarn using PPA on Debian 10

The steps in this process are as follows:

Step 1: Import the GPG key and enable the yarn repository

Use the following command to import the GPG key from the yarn's official website:

curl -sL | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null

Use the following command to add a GPG key after authentication has been completed:

echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Step 2: Install yarn

Once you've completed the previous two steps, you're ready to install yarn. However, before you do, use the following command to update the system's repository:

sudo apt update

You may now install the yarn after updating the repository by using the command:

sudo apt install yarn 

Installing yarn using yarn script on Debian 10

Using yarn script, you may use yarn to install yarn on Debian 10:

Step 1: Download the script and install the yarn

To download the script, run the command shown below. It will install a version specific to your profile and cannot be used outside your profile.

curl -o- -L | bash

How to Use Yarn on Debian 10

Create a yarn initialization directory:

mkdir yarnproject
cd yarnproject

Set up the yarn package therein:

yarn init

You can add dependencies to your project using the command listed below.

yarn add [package]

Additionally, you can specify a specific package version as a dependency:

yarn add [package]@[version]

The command listed below can be used to install all requirements.

yarn install 

How to Uninstall Yarn from Debian 10

If the yarn is no longer needed on your Debian 10 system, you can remove it from your computer. Use the following command to remove the yarn from your Debian 10 installation:

sudo npm uninstall -g yarn

If you have installed with script, use below command to remove yarn

rm -fr ~/.yarn

Or use below command if you have installed using apt

sudo apt purge yarn -y

FAQs: Yarn Installation on Debian 10

Why should I use Yarn on Debian 10? 

Yarn offers advantages such as fast and reliable installations, consistent dependency resolution, and the ability to switch between different versions of packages.

What are the prerequisites for installing Yarn on Debian 10? 

To install Yarn on Debian 10, you need to have Node.js installed on your system. If Node.js is not already installed, you can install it using the apt package manager.

What is the recommended method to install Yarn on Debian 10? 

The recommended method to install Yarn on Debian 10 is using the curl command to download the Yarn installation script and executing it with bash.

How do I check if Yarn is installed correctly on Debian 10? 

After installing Yarn, you can verify its installation by running the command yarn --version in the terminal. It should display the version of Yarn installed on your Debian 10 system.

How do I update Yarn to the latest version on Debian 10?

To update Yarn to the latest version on Debian 10, you can run the command sudo apt update && sudo apt upgrade yarn.

Can I switch between different versions of Yarn on Debian 10? 

Yarn allows you to switch between different versions using the yarn set version command. For example, you can run yarn set version 1.22.10 to switch to version 1.22.10.

What are the advantages of using Yarn on Debian 10? 

Some advantages of using Yarn include fast and parallel installations, reliable dependency resolution, offline mode for working in disconnected environments, and automatic management of lock files.


Installing Yarn on Debian 10 provides you with a fast, reliable, and efficient package manager for JavaScript development projects.

With advantages such as parallel installations, optimized dependency resolution, offline mode support, and automatic lock file management, Yarn enhances the development experience for Node.js developers.

By following the installation instructions outlined in the tutorial, you can easily set up Yarn on your Debian 10 system and start leveraging its benefits

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.