Dinesh Veera
Dinesh Veera

Reputation: 181

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

I installed yarn using the following command

npm install yarn -g

Then it shows the following status:

> [email protected] 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
+ [email protected]
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?

Upvotes: 18

Views: 52912

Answers (2)

zhangkun
zhangkun

Reputation: 51

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

Upvotes: 3

Ric
Ric

Reputation: 8805

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

Upvotes: 31

Related Questions