How to Install yarn in Microsoft Windows

Posted on

Introduction

In this article, the main focus is just to show how to install yarn in Windows. Actually, the main purpose is to be able to run a React JS application. In order to run or to start the React JS application, it needs ‘yarn’. So, before starting the React JS application, there is a need to install ‘yarn’.

How to Install yarn in Microsoft Windows

So, this part is specifically describing to show how to install ‘yarn’ in Microsoft Windows. Actually, it is very easy for installing ‘yarn’ in Microsoft Windows. Before going on further, do not forget to have ‘npm’ tool. Because it will use ‘npm’ tool in order to install ‘yarn’ in this context. In order to make sure that ‘npm’ tool is available, just type the following command in the command prompt :

C:\apps>npm
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm <command>
Usage:
npm install install all the dependencies in your project
npm install <foo> add the <foo> dependency to your project
npm test run this project's tests
npm run <foo> run the script named <foo>
npm <command> -h quick help on <command>
npm -l display usage info for all commands
npm help <term> search for help on <term> (in a browser)
npm help npm more involved overview (in a browser)
All commands:
access, adduser, audit, bin, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, rebuild, repo,
restart, root, run-script, search, set, set-script,
shrinkwrap, star, stars, start, stop, team, test, token,
uninstall, unpublish, unstar, update, version, view, whoami
Specify configs in the ini-formatted file:
C:\Users\Personal\.npmrc
or on the command line via: npm <command> --key=value
More configuration info: npm help config
Configuration fields: npm help 7 config
[email protected] C:\Program Files\nodejs\node_modules\npm
C:\apps>

As it exist in the above output command, the ‘npm’ command is running well. In other words, the ‘npm’ command is available. In that case, just go to the next step. Just execute the following command in Microsoft Windows’ command line to install ‘yarn’ using npm :

npm install --global yarn

Using the above command pattern syntax, below is the execution of the command in an actual situation :

C:\apps>npm install --global yarn
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
added 1 package, and audited 2 packages in 3s
found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 8.11.0 -> 8.17.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.17.0
npm notice Run npm install -g [email protected] to update!
npm notice
C:\apps>

Last but not least, just check whether the ‘yarn’ module or package is exist as a result from the above installation execution. In order to check the available module or package, just type the following command :

C:\apps>npm list
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
[email protected] C:\apps
...
...
...
`-- [email protected]
C:\apps>

In order to keep the output of the above command short, it only displays the line which is showing ‘yarn’ package or module’. That means, it has already exists so that the installation is a success.

Leave a Reply