Introduction
Yarn is a package manager developed by Facebook as an alternative to the NPM client. It allows teams to develop JavaScript code and share it through software packages.Yarn brings a host of improvements compared to NPM, such as higher speed, reliability, and greater compatibility. There are several methods of installing Yarn, from using the MSI installation file to using other package managers and installing it from the Windows PowerShell.In this tutorial, we will offer a step-by-step process for different methods of installing Yarn on Windows.
Prerequisites
- A system running Windows
- Access to a user account with administrator privileges
- Access to the PowerShell
- A copy of Node.js installed
Note: Bare Metal Cloud was build by a DevOps team for DevOps teams. It supports IaC tools and automated server provisioning via API and CLI. Launch a Windows-powered Bare Metal Cloud server and follow this guide to configure Yarn on it.Get a development sandbox environment for as low as $0.10/hour!
Install Yarn on Windows via MSI Installer
1. Download the Yarn installation file from GitHub.2. Run the installation file and click Next to proceed.




yarn --version

Install Yarn on Windows via Chocolatey Package Manager
Another method is to use the Chocolatey package manager to install Yarn. Using Chocolatey also helps resolve dependencies since it automatically installs Node.js:1. Open the PowerShell as an administrator.2. Check the status of the execution policy with:Get-ExecutionPolicy

Restricted
, set it to AllSigned
using:Set-ExecutionPolicy AllSigned
4. When prompted, type Y and press Enter to confirm.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
6. Run the following command to install Yarn:choco install yarn

yarn --version

Install Yarn on Windows via Scoop CLI
The Scoop CLI (command line installer) works in a similar way to Chocolatey, with the main difference being that Scoop does not automatically install Node.js.1. Open the PowerShell as an administrator.2. Set the execution policy to allow PowerShell to run local scripts:set-executionpolicy remotesigned -scope currentuser
3. When prompted, type Y and press Enter to confirm.
iwr -useb get.scoop.sh | iex

scoop install yarn

yarn --version

Install Yarn on Windows via NPM
NPM (Node Package Manager) is a package manager included with the Node.js installation. It is used for developing and sharing JavaScript code, but it also provides another method of installing Yarn:1. Open the PowerShell as an administrator.2. Install Yarn by running the following command:npm install --global yarn

yarn --version
