Yarn worked for me until I decided that I needed several versions of node. So I removed the yarn and installed nvm following the instructions in the following guide
Then I successfully reinstalled the yarn using the msi installer. Unfortunately, yarn global add [name] installed the packages in a place that, it would seem, covered all the nvm-managed versions of the node and were equally inaccessible to all of them. That is, npm could not find anything installed globally by thread. Or, for example, after using yarn to install gulp all over the world, I found that gulp is not available on the command line (and its cmd files were not found in c: \ program files \ nodejs).
So, I deleted the msi thread. Then I set yarn again using npm i --global yarn , like here . This finally led the yarn to be tied to the current version of node nvm. Excellent.
However, when I tried yarn again to install global packages, I found that they were not installed properly. For example, I ran:
nvm use 5.11.0 yarn global add jspm gulp karma karma-cli
The packages were installed successfully, but when I try gulp from the command line, it is not available. Also, when I npm ls --global --depth=1 , I see that the packages I installed are not found anywhere. If I try yarn global ls --depth=0 , I need to say for a very long time that my packages (jspm, gulp, karma, karma-cli) are actually installed.
Even worse, I later decided to do the following:
nvm use 7.3.0 //fresh node install...no packages installed npm i --global yarn yarn global ls
Then the yarn command shows me the same packages that I installed all over the world when nvm use 5.11.0 effect. In short, the yarn insists on some kind of global installation location (apart from what the n5 versions controlled by nvm see). I also donβt know where the file is located, where yarn stores these global packages, so Iβm not sure how to βclearβ the deletion, which I could try.
In short, I don't think yarn and nvm are compatible. Is it correct?
Version Information
- Windows 10 Pro x64
- nvm v1.1.3
- yarn v0.21.3
- node 5.11.0 (NVM selected)
- node 7.8.0 (NVM selected)
Update
I found question 1491 that might contain my answer. I found out that:
- The location of globally installed yarn packages is intentionally in a different location than packages installed globally for npm.
- In fact, there is a problem with yarn that prevents access to globally installed packages on the command line (doh!). This violates the goal of a global package installation.
- The location where the yarn stores its data in Windows,
%LocalAppData%\Yarn
I think the yarn works before I installed nvm, I just did not try to use global packages ... and thus did not notice the error yet. In short, I think this is normal with nvm. However, now I feel like I'm npm i --global yarn time using the npm i --global yarn to set the yarn ... because the yarn will just put all its global packages in one place. And due to the current error, the only tool I have to use to install global packages is npm itself.