I switched to Yarn a while ago, because Npm is incredibly limited. And while I enjoy fast speed on macOs and Linux, Windows has always been a bit slow.
I never actually thought to investigate the issue until one frustrated evening, I had the task manager open and noticed Windows Defender was going crazy when I was doing a yarn install
on a pulled down SPA app.
Turns out disabling Windows Defender halved the amount of time it took to not only resolve dependencies but link them from the local cache.
Disabling Windows Defender is half the battle, though. As disabling it via the Windows Defender settings panel only does so temporarily.
The real fix is to actually a couple of Node.js folders to the Windows Defender exclusions list. You can do this via the settings panel.
The Node.js folder is located at: c:\Program Files\nodejs
and lastly the npm
global folder is at: c:\Users\YourUserName\AppData\Roaming\npm
Ignore both of these folders and you will see Yarn speed up dramatically.
I guess the downside of the Node ecosystem being comprised of tens of thousands of files spells doom when antivirus and malware scanning software gets in the way.
Now I wonder, what else was Windows Defender slowing down?