Categories: Ubuntu

How to Install Yarn on Ubuntu

Yarn is a popular JavaScript package manager that enables developers to speed up and automate the process of managing their JavaScript libraries and dependencies. It is an open-source project used to install and manage core packages for Node.js applications, as well as Java projects. With its numerous features, it is the most reliable and efficient package manager for JavaScript.

This article will cover detailed methods of installation of Yarn on Ubuntu systems.

Install Yarn on Ubuntu

There are two simplest methods to install Yarn on Ubuntu system, which are as follows:

Method 1: Through Apt Package Manager

Sponsored

The installation process of Yarn on Ubuntu consists of following steps:

Step 1: First update the apt packages list on Ubuntu from the following command:

sudo apt update && sudo apt upgrade

Step 2: Once the update command is executed, you can then type in this command to install Yarn on Ubuntu.

sudo apt install yarn

Step 3: To verify that the correct version of Yarn has been installed, you can type in the following command:

yarn –version

You can add packages using Yarn via this command.

yarn add foo

Note: foo is the package name.

Sponsored

Remove Yarn from Ubuntu

Yarn can be removed from Ubuntu using the ‘apt’ command.

sudo apt remove yarn

Method 2: Through NPM

Yarn can also be installed in Ubuntu using Node Package Manager (NPM) using these below-given steps.

Step 1: To install Yarn, we need to first make sure that we have NPM and upgrade to its latest version.

npm –version

Step 2: Execute this command to install Yarn via NPM.

sudo npm install -g yarn

Note: To remove yarn through NPM, just add uninstall in place of install.

Conclusion

Yarn is a powerful and reliable package manager used to install and manage JavaScript libraries and other dependencies. This article has covered the detailed procedure of installing Yarn on Ubuntu operating systems using the apt package manager or NPM. By following the above steps, developers can easily install Yarn on Ubuntu systems using any of the given methods.

Ubuntu Server Admin

Recent Posts

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

21 hours ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

21 hours ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

21 hours ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

3 days ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

4 days ago