1. Install Yarn using NPM
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 current project only.
sudo npm install yarn -g
2. Install Yarn using Script
This is the most recommended way for the yarn installation. This downloads the yarn archive and extracts under the .yarn directory at home. The script also set the PATH environment variable.
curl -o- -L https://yarnpkg.com/install.sh | bash
Using this installation yarn is available for current user only.
3. Install Yarn using Yum
Yarn packages are also available with yum package manager. You can configure yarn official yum repository using the below command:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
If you do not already have Node.js installed, you should also install nodejs
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
## Run `sudo yum install -y nodejs` to install Node.js 6.x LTS Boron and npm.
## You may also need development tools to build native addons:
sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
Then you can simply:
sudo yum install yarn ## CentOS and Redhat systems ## OR ## sudo dnf install yarn ## Fedora systems
Test that Yarn is installed by running: