'Git Bash Command on Windows, yarn command not found

I following this online tutorial on downloading and installing web files from GIT HUB. I got down to the topic: Starting Our Static Website, there I'm prompted to enter the commands to download and install the web files. However, when I enter the command yarn install, I get the following prompt: bash: yarn: command not found

...My question is has anyone else encountered this problem and if so, how was it resolved? I'm using GIT Bash command prompt on Windows 10.

Thanks in advance for any assistance.



Solution 1:[1]

If you are using Mintty (Bash) then you simply do npm install -g yarn

Solution 2:[2]

The official Yarn setup does not tell you you need to restart your computer, but you actually have to before you can use it from your shell. So, install it from

https://yarnpkg.com/lang/en/docs/install/#windows-stable

then restart your PC and you should be able to run yarn from your console.

Solution 3:[3]

Working in Visual Studio Code?

  1. Open a new terminal

    • Click "Terminal" ? "New Terminal"

      or

    • Simply use ctrl+shift+` (backtick)

      • (this backtick button is on the left of the 1 key and below Esc)
  2. Once the Terminal is active, install Yarn by running npm install -g yarn.

  3. Verify the installation was successful by running yarn --version.

Solution 4:[4]

What resolved this for me was repairing my Node install:

  1. Go to Add or remove programs
  2. Search for "Node.js"
  3. Choose Modify
  4. Choose Next and then Repair

After doing that I was able to run yarn without issue.

Solution 5:[5]

If you install yarn through MSI on windows10, and the software installed on C:\Program Files (x86)\Yarn\bin, but the path set in C:\Users\{username}\AppData\Local\Yarn\.bin, so change the path(both user and system) to C:\Program Files (x86)\Yarn\bin.

Solution 6:[6]

Try to type yarn.cmd on git bash, it should work fine. for example: yarn.cmd --version.

Solution 7:[7]

I followed the official yarn installation for windows but is loading a page no found on github

https://github.com/yarnpkg/yarn/releases/download/v1.22.17/yarn-1.22.17.msi

so I had to the manual way which is adding the path into the environment variables

asuming you already have installed npm, if you are not sure type in the terminal npm -v

  1. install yarn on the terminal using npm install --global yarn

  2. check the yarn packages has been installed on C:\Users\yourusername\AppData\Roaming\npm\node_modules\yarn

  3. if you can see the package on your node_modules you just need to add the bin folder that is inside the yarn into your environment variables

  4. On the Windows taskbar, right-click the Windows icon and select System.

  5. In the Settings window, under Related Settings, click Advanced system settings. enter image description here

  6. On the Advanced tab, click Environment Variables. enter image description here

  7. Click on Edit and add C:\Users\yourusername\AppData\Roaming\npm\node_modules\yarn enter image description here

  8. Press ok save open a new terminal and try running yarn -v

Solution 8:[8]

Please check first that yarn is install or not globally

C:\Users\username\AppData\Roaming\npm\node_modules\yarn

If there is, then add this to your environment variable

C:\Users\username\AppData\Roaming\npm\node_modules\yarn\bin

Solution 9:[9]

Download and install yarn wizard first in order to run commands related to yarn.Click on the below link to start the download automatically: https://yarnpkg.com/latest.msi

Solution 10:[10]

I could reproduce the same issue on git bash. However when i tried the same in command prompt it worked!

on bash - $ yarn add axios bash: yarn: command not found

on command prompt - yarn add v1.22.5 .... [1/4] Resolving packages...

Solution 11:[11]

If you don't have npm, you can do the following (taken from yarn installation instructions):

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn

Solution 12:[12]

It looks like there might be an issue with Yarn and certain environments. See this GitHub issue for more details.

Solution 13:[13]

I had same issue and for me install yarn by the installer

From the yarn official website Yarn Official website

Solution 14:[14]

Use this command on macbook brew install yarn