Install Yarn on Rocky Linux 8

0
455

Last updated on August 23rd, 2021 at 09:44 pm

Follow through this guide to learn how to install Yarn on Rocky Linux 8. Yarn is an acronym for Yet Another Resource Navigator, and is a fast, secure and reliable JavaScript package manager that is compatible with npm registry and can be used with npm.

Install Yarn on Rocky Linux 8

Prerequisites

In order to install Yarn, you need to have NPM installed.

Install latest Nodejs Package Manager on Rocky Linux. Nodejs 16.x is the current stable release based on the releases page.

curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
dnf install nodejs

Nodejs installs NPM.

npm -v
7.18.1

Install Yarn on Rocky Linux 8

There are multiple ways in which you can install:

Install Yarn on Rocky Linux 8 via npm

Assuming that NPM is already installed, you can then install Yarn on Rocky Linux 8 via npm using the command below;

npm install --global yarn 

Checking the version of installed Yarn on Rocky Linux 8;

yarn -v
1.22.10

Uninstall Yarn

If for some reasons you want to uninstall Yarn, you can use the command below;

npm uninstall -g yarn

Install Yarn on Rocky Linux 8 via DNF/YUM

Once you have NPM installed via the Nodejs, you can install Yarn on Rocky Linux 8 via the YUM repository by running the commands below;

curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
dnf install yarn

Install Yarn on Rocky Linux 8 via install Script

The easiest way to install Yarn on Rocky Linux 8 is via install script. You can simply run the command below to download and run the Yarn installation script.

dnf install curl tar
curl -o- -L https://yarnpkg.com/install.sh | bash

Sample command output;

...
> GPG signature looks good
> Extracting to ~/.yarn...
> Adding to $PATH...
> We've added the following to your /root/.bashrc
> If this isn't the profile of your current shell then please add the following to your correct profile:
   
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

> Successfully installed Yarn 1.22.5! Please open another terminal where the `yarn` command will now be available.

The script dont install yarn globally and so if you can update your PATH environment variable as shown from the command output.

Source your bashrc and verify the Yarn version:

source ~/.bashrc
yarn -v

That marks the end of our tutorial on how to install Yarn on Rocky Linux 8.

Read more on Yarn Documentation page.

Other Tutorials

Install Latest Nodejs on Rocky Linux 8

Install PHP Composer on Rocky Linux 8

Install PHP 8.0 on Rocky Linux 8

LEAVE A REPLY

Please enter your comment!
Please enter your name here