Adam. R

How to install Yarn on Ubuntu!

Created October 12, 2021

What is Yarn?

Yarn is a JavaScript package manager compatible with npm that helps you automate the process of installing, updating, configuring, and removing npm packages. It caches every download package and speeds up the installation process by parallelizing operations. It is like NodeJS.


Installation

Installing Yarn on Ubuntu is fairly straightforward. We’ll enable the official Yarn repository, import the repository GPG key, and install the package. The repository is consistently maintained and provides the most up-to-date version. Import the repository’s GPG key and add the Yarn APT repository to your system by running the following commands:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Once the repository is enabled, update the package list, and install Yarn.

sudo apt update
sudo apt install yarn -y

The command above will also install Node.js . If you installed Node trough nvm, skip the Node.js installation with:

sudo apt install --no-install-recommends yarn

Once completed, verify the installation by printing the Yarn version:

yarn --version

That’s it, you have successfully installed Yarn on your Ubuntu Server and you can start using it!

If you found this usful then please share this and follow me! Also check out my website where I also post everything from here