npm v5.0 brings a lot of features currently present in yarn, including:
--save
by defaultpackage-lock.json
will be automatically created (I assume the lock file ensures consistent installs)From my understanding, what yarn offers in addition is parallel downloads (therefore faster download time). I don't see that mentioned in the npm blog post. Apart from this, are there other benefits to still using yarn?
Yarn is still, as of writing, slightly faster than npm. Thomas Schaaf has produced a comparison based on performance which can be viewed directly here. Currently, Yarn beats npm on every measurement, although not by a large margin. That's probably from the parallel downloads and superior caching, although that's purely conjecture and I haven't done any digging in the source to find out why the timing is different.
However, what you lose in performance, you gain in compatibility. There are a few packages that don't install correctly with Yarn, such as semantic-ui
, so you'd need to use npm for that anyway.
Since npm is the canonical package manager for Node environments, most packages will have been tested to work with npm. The same can't be said for Yarn—it's still a relative outsider.
Overall, though, I think npm@5 is far better than its predecessors, and I think it'd be reasonable to "switch back" unless Yarn brings new features to the table, especially if compatibility with all packages is important to you.
That's a good question!
Indeed npm
was pushed to have all these features yarn
offers. Now they are pretty much the same:
--save
is enabled by defaultpackage-lock.json
locks your versions and it is not optional as it were with npm shrinkwrap
npm@5
also made a good progress at speed, but yarn
is still faster. Here are the simple figures. Let's test it with vue-starter
which has around 850 packages to download. npm
’s time was not bad at all with 42 seconds at the fresh run. When the cache is ready, it takes only 30 seconds to install everything.
Compared to yarn
: 35 seconds without cache and 20 seconds with the cache in place. For me, this time gap was important enough to still use yarn
as a primary tool.
Actually, I wrote an article which covers all these topics: https://medium.com/wemake-services/is-yarn-still-a-thing-3c6886410c83
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With