Skip to content

Installing Yarn on Windows 11 (MDX)

This guide provides step-by-step instructions for installing Yarn package manager on Windows 11.

  • Windows 11 operating system
  • Node.js installed (Yarn requires Node.js to function properly)

There are multiple ways to install Yarn on Windows 11. Choose the method that works best for your setup.

Section titled “Method 1: Installing via npm (Recommended)”

If you already have Node.js installed, this is the simplest approach:

  1. Open Command Prompt or PowerShell as Administrator
  2. Run the following command:
Terminal window
npm install --global yarn
  1. Verify the installation:
Terminal window
yarn --version

Method 2: Installing via the MSI installer

Section titled “Method 2: Installing via the MSI installer”
  1. Visit the official Yarn website: https://classic.yarnpkg.com/en/docs/install/#windows-stable
  2. Download the Yarn installer (.msi file)
  3. Run the downloaded MSI file and follow the installation wizard
  4. Restart your command prompt or terminal
  5. Verify the installation:
Terminal window
yarn --version

If you use Chocolatey package manager:

  1. Open Command Prompt or PowerShell as Administrator
  2. Run the following command:
Terminal window
choco install yarn
  1. Verify the installation:
Terminal window
yarn --version

If you use Scoop package manager:

  1. Open Command Prompt or PowerShell as Administrator
  2. Run the following command:
Terminal window
scoop install yarn
  1. Verify the installation:
Terminal window
yarn --version

After installation, you may want to configure Yarn:

  1. Set up your npm registry (if using a custom one):
Terminal window
yarn config set registry https://registry.npmjs.org/
  1. Initialize a new project:
Terminal window
yarn init
  1. “‘yarn’ is not recognized as an internal or external command”

    • Restart your terminal/command prompt
    • Ensure Yarn was added to your PATH during installation
    • Try reinstalling Yarn
  2. Permission issues

    • Make sure you’re running the installation as Administrator
  3. Node.js not found

    • Install Node.js before installing Yarn
    • Verify Node.js installation with
    Terminal window
    node --version

Once Yarn is installed, you can use these common commands:

  • Initialize a new project:
    Terminal window
    yarn init
  • Add a dependency:
    Terminal window
    yarn add [package]
  • Add a dev dependency:
    Terminal window
    yarn add [package] --dev
  • Install all dependencies:
    Terminal window
    yarn
    or
    Terminal window
    yarn install
  • Upgrade a package:
    Terminal window
    yarn upgrade [package]
  • Remove a package:
    Terminal window
    yarn remove [package]

This installation guide is provided under the MIT License.