Bobcares

How to install Yarn on Windows?

by | Sep 23, 2020

The install of Yarn on Windows can be done in three different ways. These include that via MSI Installation, Chocolatey Installation, and Scoop Installation.

As a part of our Server Management Services, we help our Customers with Software installations regularly.

Let us today discuss the possible causes and fixes for this error.

 

Steps to install Yarn on Windows

Yarn is an alternative npm-client that allows us to share code with other developers around the world and use solutions from other developers.

The package contains a .package.json file that describes the contents, as well as all the associated distributed code. Let us now discuss the steps to install Yarn.

Install Node.js

Before installing Yarn, we need to install Node.js must. We can verify the presence of node.js on our system using the Windows terminal or PowerShell.

First, open the terminal by pressing the Win+R buttons and then enter cmd. Then, using the command line, we can verify if Node.js is installed with the command:

C:\Windows\system32>node --version
‘node’ is not recognized as an internal or external command, operable program or batch file.
C:\Windows\system32>

To install node.js, we can download the installer from the main node.js website. Now run the installer and accept the license agreement.
Then, leave all the defaults set and click Next to install node.js. Finally, click on Finish, to complete the installation.

 

Yarn Installation

Now that have installed node.js in the system, the next step is to install Yarn. There are several different methods to install Yarn in Windows. Some of them include:

  • MSI Installation
  • Chocolatey Installation
  • Scoop Installation

 

MSI Installation

The first method we will use to install Yarn is to Download the Yarn .msi installer from the official Yarn website and install it on the local computer.

Next, we will run the .msi installer and accept the license agreement. Now, click Install and finally, click on the Finish button.

Then, we can verify Yarn was installed using the following CLI commands.

C:\Windows\system32>yarn --version
1.22.4

 

Chocolatey Installation

Another way to install Yarn is by using the Chocolatey package manager for Windows. This method is convenient because Chocolatey will determine whether node.js is already installed and if not, it will automatically install it for us. Steps to perform this is available in the official site here.

Once Chocolatey is set up, we can install Yarn using the following command.

C:\Windows\system32>choco install yarn

Finally, we can verify our installation of yarn using the following command.

C:\Windows\system32>yarn --version
1.22.4

 

Scoop Installation

The third method of installing Yarn is by using the Scoop command-line installer for Windows. Scoop has functionality that is similar to Chocolatey. However, the difference is that Chocolatey will install node.js if we do not already have it but scoop will not. The scoop can be installed using the information found on the scoop website.

To install node.js using scoop, run the following command.

scoop install nodejs

Next, we can install yarn using this command.

scoop install yarn

 

Common Yarn Commands

Let us now have a look at some of the basic Yarn commands:

  • To review the yarn command – yarn help
  • Start a New Project – yarn init
  • Install all the dependencies – yarn or yarn install
  • Add a dependency to a project – yarn add [package] or yarn add [package]@[version] or yarn add [package]@[tag]
  • Remove an existing dependency – yarn remove [package]
  • Upgrade Yarn to the latest version – yarn set version latest or yarn set version from sources

To add dependencies to a specific category, use the following commands:

  • Dev Dependencies – yarn add [package] –dev
  • Peer Dependencies – yarn add [package] –peer
  • Optional Dependencies – yarn add [package] –optimal

 

Upgrade a Dependency

To upgrade an existing dependency, we can use the yarn up command.

yarn up [packagename]
yarn up [packagename]@[version]
yarn up [packagename]@[tag]

[Need any further assistance to install Yarn on Windows? – We’re available 24*7]

 

Conclusion

In short, install of Yarn on Windows can be done in three different ways. Today, we saw how our Support Engineers install Yarn in Windows via MSI Installation, Chocolatey Installation, and Scoop Installation.

 

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.