Written by , Updated on December 31, 2019

Yarn is the package management tool for the Node.js application. It provides a fast and efficient way for package installation on your system. It makes a cache of every downloaded package on your system to re-use them. This tutorial will help you to install Yarn on CentOS 8 and RHEL 8 systems.

Prerequsities

Install Yarn on CentOS 8

Yarn package is available to install with NPM. You can simply run the following command to install Yarn globally. Also, remove -g option to install for the current project only.

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
sudo dnf install yarn --disablerepo=AppStream 

After completing the installation, view the installed yarn version using the following command:

yarn --version

1.21.1

Using Yarn on CentOS 8

Here are some basic commands of 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.

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..