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?
It works. How to exclude folders in Windows Defender for Windows 10:
https://support.microsoft.com/en-us/instantanswers/64495205-6ddb-4da1-8534-1aeaf64c0af8/add-an-exclusion-to-windows-defender
Great tip, I’d update the article with Balders comment, thx for that 😉
It looks like it’s not working anymore. Since my last Windows update Yarn is extremely slow. I have tried to disable Windows Defender completely and it’s still very slow.
You can also exclude processes from Windows Defender So excluding node.exe I guess will be fine
Thank you, I tried things from several different blogs, and this is the only one that worked. In our case it was a server in Azure with Windows Defender.
Nice, thank you!
Yeah right. Those working in a corporate environment can’t do a thing about it.