Installation Guide

Install Yarn on Windows, macOS, and Linux

guide

Yarn Installation Guide

Install Yarn on Windows, macOS, and Linux.

Prerequisites

Yarn requires Node.js to be installed on your system. You can install Node.js from nodejs.org.

Installation Methods

Method 1: Install via npm (Recommended)

The easiest way to install Yarn is through npm:

npm install -g yarn

Method 2: Install via Package Manager

macOS (using Homebrew)

brew install yarn

Ubuntu/Debian

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
sudo apt update
sudo apt install yarn

Windows (using Chocolatey)

choco install yarn

Method 3: Install via Corepack (Node.js 16.10+)

Corepack is included with Node.js and can manage Yarn:

corepack enable
corepack prepare yarn@stable --activate

Verify Installation

Check that Yarn is installed correctly:

yarn --version

Configuration

Set Default Registry

yarn config set registry https://registry.yarnpkg.com/

Set Cache Directory

yarn config set cache-folder ~/.yarn-cache

Resources