“bash: yarn: command not found” or “‘yarn’ is not recognized as an internal or external command, operable program or batch file” is a general error message you may encounter while using the yarn command in Windows or Linux. In this article, we will dip dive into the details and how you can resolve this “command not found yarn” error message.

Before jumping into the solution, let’s understand what is yarn and the reason behind this error.
What is Yarn?
Yarn is a javascript package manager for your project be it javascript or react. You can use others’ code or share your project/components/snippets with other developers using the yarn package manager. It’s one of the most popular, secure, and reliable tools available to manage javascript code.
If you are facing a “yarn: command not found” error message in the command prompt or Visual Studio Code then this post will walk you through the steps to get rid of the error.
Steps to fix “yarn: command not found”:
Step1: Check if yarn is installed on your computer
You first must check whether you have installed the yarn package manager in your project or on your computer. If you have not installed yarn package manager and tried to use the yarn command then it’s expected to get the yarn command not found error message as this function is not available to your project.
While there are multiple ways to install the yarn package manager, you can use these simple ways to install yarn.
i. Install the executables directly on your computer:
- Download yarn exe from the official website.
- After installing yarn executable, update the PATH environment variable.
e.g. if you have installed yarn in Program Files, then add C:\Program Files (x86)\Yarn\bin to the PATH environment variable under the ‘System Variables‘ section.
Note: After installing yarn, you will still get “yarn: command not found” error if the PATH is not added.
ii. Install through Node.js using npm
The recommended way of installing yarn is through Node.js as it is platform-independent. The yarn package is bundled in the Node.js setup and can be installed easily via npm (node package manager).
- Install Node.js if not installed already.
- Open command prompt or terminal.
- Execute the below command.
Note: Use –global command in order to install yarn globally for all projects. If you do not use –global, you need to install yarn manually for each project.
npm install --global yarn
Step 2: Check if yarn is installed successfully
To test if the yarn is installed successfully or not, run the following command on the bash terminal or command prompt.
yarn -version

Now it will show the installed version of the yarn application. If you are still getting yarn: command not found error or “‘yarn’ is not recognized as an internal or external command, operable program or batch file“then reverify if you have followed the above steps as mentioned.
Note: After setting the yarn installation path in the Path environment variable, make sure to use a new terminal to execute the yarn command. If you try to run the yarn command on the same terminal then you will again get the “yarn: command not found” error message.
That’s all about fixing the yarn command not found error. If you are still facing the issue then do mention it in the comment section or you can reach out to us using the contact form.
even tho I installed npm and yarn corect, when I check the version, the same error already appears:
393330@785-5949 MINGW64 /c/Users/393330/Desktop/intranet-app
$ npm install –global yarn
changed 1 package in 344ms
393330@785-5949 MINGW64 /c/Users/393330/Desktop/intranet-app
$ yarn –version
bash: yarn: command not found