'yarn' is not recognized as an internal or external command, operable program or batch file

Viewed 20192

I installed yarn using the following command

npm install yarn -g

Then it shows the following status:

> yarn@1.22.10 preinstall C:\Users\vdine\AppData\Roaming\npm\node_modules\yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

C:\Users\vdine\AppData\Roaming\npm\yarn -> C:\Users\vdine\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js
C:\Users\vdine\AppData\Roaming\npm\yarnpkg -> C:\Users\vdine\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js
+ yarn@1.22.10
added 1 package in 0.962s

Then I added the yarn path to the environment variable

C:\Users\**path**\AppData\Roaming\npm\node_modules\yarn\bin

but its still shows "'yarn' is not recognized as an internal or external command, operable program or batch file."

What should I do now?

2 Answers

Updated Jan '21

The recommended method for installation Yarn is now via npm:

npm install --global yarn

https://classic.yarnpkg.com/en/docs/install/

Try adding C:\Users\vdine\AppData\Roaming\npm to your PATH environment variable instead of C:\Users\**path**\AppData\Roaming\npm\node_modules\yarn\bin

Previously

The recommended method for installing Yarn is your OS tools instead of npm, check out the MSI method:

http://web.archive.org/web/20201226122851if_/https://classic.yarnpkg.com/en/docs/install/#windows-stable

remove file C:\Users\vdine\AppData\Roaming\npm\node_modules\yarn and run npm install -g yarn --force

Related