yarn

What is Yarn?
Yarn is another package manager, an alternative to npm. It was built by developers at Facebook while Npm, Inc. (A Github owned organisation) is behind npm. 

Yarn Vs NPM
When Yarn started, it had many better things to offer than npm. It was fast, secure, lock file and much more but now in 2021, it just comes down to developer preference. Both are fast, secure and provide almost the same features. Just one difference - Yarn maintains a flat dependency tree while npm maintains the nested one. 

If confused just go with npm or try both. 😜

How to install Yarn?

npm install -g yarn

How to install a package from npmjs.com using Yarn? 

yarn add date-fns

Yes, that same package but installation using Yarn instead of npm. 

Any other package manager that worth knowing?
There are many other package managers other than `npm` and `yarn` but recently many are adopting pnpm. It's worth checking it. 


Discussion