Yarn Installation

suggest change

This example explains the different methods to install Yarn 1 (Classic). yarn global is a Yarn 1 command. The NodeSource setup_6.x lines are that era's Node 6 installer. NodeSource no longer supports those scripts.

macOS

Homebrew

brew update
brew install yarn

MacPorts

sudo port install yarn

Adding Yarn to your PATH

Add the following to your preferred shell profile (.profile, .bashrc, .zshrc etc)

export PATH="$PATH:`yarn global bin`"

Windows

Installer

First, install Node.js if it is not already installed.

Download the Yarn installer as an .msi from the Yarn website.

Chocolatey

choco install yarn

Linux

Debian / Ubuntu

Ensure Node.js is installed for your distro, or run the following

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Configure the YarnPkg repository

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Install Yarn

sudo apt-get update && sudo apt-get install yarn

On Debian and Ubuntu, the cmdtest package also ships a yarn command. Remove cmdtest first if apt selects that package.

CentOS / Fedora / RHEL

Install Node.js if not already installed

curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -

Install Yarn

sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
sudo yum install yarn

Arch

Install Yarn via AUR. yaourt is unmaintained.

Example using yaourt:

yaourt -S yarn

Solus

sudo eopkg install yarn

All Distributions

Add the following to your preferred shell profile (.profile, .bashrc, .zshrc etc)

export PATH="$PATH:`yarn global bin`"

Alternative Method of Installation

Shell script

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

or specify a version to install

curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version [version]

Tarball

cd /opt
wget https://yarnpkg.com/latest.tar.gz
tar zvxf latest.tar.gz

The yarn binary is inside the extracted directory. These commands do not add it to PATH.

Npm

If you already have npm installed, simply run

npm install -g yarn

Post Install

Check the installed version of Yarn by running

yarn --version

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents