15.1 C
Texas
angeloma
Senior Writer and partner

Install Yarn on Debian 11

Hello, friends. Installing Yarn on Debian 11 opens the door to NodeJS project management in a fast and efficient way. So, in this post, I will tell you what it is and how to install it so you can get it ready for your projects.

What is Yarn?

Yarn is a package manager that doubles down as a project manager. Whether you work on one-shot projects or large monorepos, as a hobbyist or an enterprise user, we’ve got you covered.

Its main advantages are stability, speed of work, and ease of use. Another aspect to take into account is that Yarn is open source so we can examine the source code of the application without any problems.

On the other hand, Yarn has support for plugins that further increase the functionality of the application.

- Advertisement -

So, let’s go for it.

Install Yarn on Debian 11

The method recommended by the official Yarn documentation is using npm and therefore NodeJS. So, this has to be our first step.

How to install NodeJS on Debian 11?

After the installation is finished, you can install Yarn on Debian 11 by executing the following command

sudo npm install -g yarn
> [email protected] preinstall /usr/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

/usr/bin/yarn -> /usr/lib/node_modules/yarn/bin/yarn.js
/usr/bin/yarnpkg -> /usr/lib/node_modules/yarn/bin/yarn.js
+ [email protected]
added 1 package in 1.073s

Then you can check the installed version with the following command

yarn --version
1.22.11

To always update Yarn to the latest version, you have to run the following command

yarn set version latest

Using Yarn

Once we have Yarn installed on our computer the next thing to do is to use it a little bit.

Create a new folder for the new project. For example project.

mkdir project

Access the folder and start the yarn project as follows

cd project
yarn init

And to add dependencies to the newly created project you can run

yarn add [package]

Or specify a specific version

yarn add [package]@[version]

If you want to remove any dependencies, just run

yarn remove [package]

To install all dependencies

yarn
yarn install

But you can also update the dependencies

yarn up [package]

Or by specifying a version

yarn up [package]@[version]

Finally, you can access all the Yarn commands by consulting the help

yarn help
1.- Yarn on Debian 11
1.- Yarn on Debian 11

So, enjoy it.

Conclusion

Yarn is a fast tool that allows us to manage the packages of our web project that is more and more used worldwide. In this post, you learned how to install it on Debian 11.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article