The development of web applications is a process that many people don’t know and think is something very easy to do. However, those of us who have developed applications know that it is not and that tools are needed to speed up the process. Especially in the web environment that requires many libraries of all kinds. This includes Javascript whose dependency management has been monopolized by NVM. However, the company Facebook in union with after big have created yarn. A javascript dependency manager that promises to be fast and reliable. In this post, you will learn how to install Yarn on Debian 10.
Yarn is a Javascript dependency manager that stands out for being fast, secure and reliable. It is presented to us as the most solid alternative to NPM. In addition, it is open source and it has the protection of a giant like Facebook what guarantees us solidity and robustness of the project. Some of its characteristics are the following:
- 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.
Conclusion
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.