3 Ways to Install Yarn in Windows
Explore the easiest methods to get this done
3 min. read
Updated on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
Key notes
- You can install Yarn using its official website, command line package manager Chocolatey, or Node.js.
- This guide will explain all the methods to install Yarn safely on Windows.
Yarn is a package manager for Javascript that aids in automating, installing, updating, and managing libraries and utilities. You can download it using various methods.
Here, we will discuss the different methods to download Yarn on Windows and some frequently asked questions related to Yarn. Letโs start!
How can I install Yarn on Windows?
Before proceeding with any steps for installing Yarn, go through the following preliminary checks:
- You need to install the latest version of Node.js or use a version manager like NVM to manage multiple versions of Node.js on your machine.
- The latest version of Git is installed to manage packages.
- A text editor or IDE is installed to write and edit code, such as Sublime Text or Visual Studio Code.
- Your computer should have a web browser installed.
- Windows PowerShell or Command Prompt with admin rights.
Once you complete the checklist, follow any of these methods to install Yarn:
1. Use the official website
- Download the Yarn installer.
- Double-click the installer (.msi) file to launch.
- Click on the Next button on the installation wizard.
- On the next window, accept the license agreement and then click Next.
- Choose the installation location if you want, or keep it default as shown and click Next.
- Click Install and then wait for it to complete.
- Now, click Finish to close the window.
- To verify Yarn installation, press Windows + X and select Terminal (Admin).
- Copy and paste the following command:
yarn --version
2. Use NPM
- Press the Windows key, type CMD and click Run as administrator.
- Type the following command and press Enter:
npm install -g yarn
- To verify Yarn was correctly installed and check the version, copy and paste this command
yarn --version
3. Use Chocolatey
- Press the Windows key, type CMD and click Run as administrator.
- Copy and paste the following command and press Enter:
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
- Once Chocolatey is installed, type the following command and press Enter:
choco install yarn
- Now on the command prompt window, you will be asked, Do you want to run this script? Type Y and press Enter. Yarn will be installed on your computer.
- Close the command prompt window.
How do I install Yarn in VS Code on Windows?
You can use method 2 to install Yarn in Virtual Studio Code on Windows. To use Yarn with Visual Studio Code, follow these steps:
- Install the Yarn extension from VS code marketplace.
- Once installed, press Ctrl + Shift + P and type Yarn. You will get a list of commands you can use on VS Code.
Where is the Yarn install directory on Windows 10?
The default address of the Yarn install directory is C:\Program Files (x86)\Yarn
However, if you have chosen a different install location at the time of installation, then open Command Prompt and type the following command, and press Enter: where yarn
Can I install Yarn without NPM?
Yes, you can install Yarn without NPM. Yarn is a separate package manager developed by Facebook and is not tied to NPM. Therefore, you can follow the first method to install Yarn without NPM.
So, these are the different methods you can use to install Yarn on your Windows. Follow any one of them, install Yarn, and start quickly managing, installing, and updating packages.ย
If you have any queries or suggestions regarding this guide, then feel free to mention them in the comments below.
User forum
0 messages