Similarity
Both yarn and npm are the package management of node.
npm is the default package management of node, whereas yarn is developed by Facebook team.
But yarn has the same package registry with npm , which means yarn and npm actually retrieve packages from the same server.
Difference
npm
- Install packages one by one
- Easy for beginners
- latest version support version lock
yarn
- Install multiple packages simultaneously (way faster)
- Cache packages for further installation.
- Version lock is introduced.
It is clear that, in the past, yarn has the advantage of stable versions of packages, but with recently introduced version lock by npm , the most significant difference between these two package managers is the speed of installation (yarn has better installing speed !!!)