- Fast: Yarn caches every package it has downloaded.
- Reliable: Using a detailed but concise lockfile format and a deterministic algorithm for install operations.
- Secure: Yarn uses checksums to verify the integrity of every installed package before its code is executed.
There are also other features such as its efficiency in the use of the network as well as offline mode. All this can be found on the Github site of Yarn.
Install Yarn on Debian 10
The installation of Yarn becomes quite easy, thanks to the fact that we have been given a package repository for Debian. This not only makes the installation easy but also allows us to keep it updated.
However, there are some necessary packages to be installed:
:~$ sudo apt install curl gpg
As you can see, I’m using sudo. If you don’t have it enabled you can do it with the following tutorial:
How to enable sudo on Debian 10?
Now we can execute the following command to add the GPG key to the repository:
:~$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - OK
And then, it’s time to add the Yarn repository for Debian 10.
:~$ 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
After the repository and its GPG key have been correctly added, the APT cache must be refreshed:
:~$ sudo apt update
And finally, install Yarn on Debian 10 with the following command:
:~$ sudo apt install yarn
As you can see in the picture, one dependency of Yarn is NodeJS and NPM. In case you already have it installed, you can install yarn with the following command:
:~$ sudo apt-get install --no-install-recommends yarn
Finally, you can check that everything went well, by showing Yarn’s version.
:~$ yarn -v
And that’s it, Yarn is ready for the job.
Yarn is a great alternative to NPM to manage the dependencies of our web projects. So it becomes essential if we are web developers or we are learning in it.
Please share this post with your friends.