Yarn is a package manager that replaces the existing npm client or other package managers. It is fully compatible compatible with the existing npm registry. Yarn provides a fast and efficient way for node.js package management on Linux systems. It makes a cache of every downloaded package on your system to re-use them.

Advertisement

This tutorial will help you to install Yarn on CentOS 8 and RHEL 8 Linux systems. Also provide basic instructions of yarn uses on Linux.

Prerequisites

Installing Yarn on CentOS 8

Yarn package are available under the official yum repositories. It also can be installed with the npm package manager on linux systems. In this tutorial, we will use official yum repository to install yarn on CentOS 8.

Open a terminal and execute following commands to configure yum repository on your centos system:

sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg 
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo 

Once you added the yum repository, execute following command to install yarn on centos 8 Linux system.

sudo dnf install yarn --disablerepo=AppStream 

Press ‘y’ for any confirmation asked by the installer.

That’s it, Yarn has been installed successfully on your Linux system. You can check installed Yarn version by executing the commnad:

yarn --version 

1.21.1

Using Yarn Command Line

Here are some basic use cases of the yarn command-line utility.

  • yarn init – Create a new application.
  • yarn add – Add a package to use in your current application/package.
  • yarn install – Installs all the dependencies defined in a package.json file.
  • yarn publish – Publish the package to the package manager.
  • yarn remove – Removes an unused package from the current application.

Conclusion

This guide helps you to install yarn package manager on CentOS 8 Linux system.

Share.
Leave A Reply

Exit mobile version