Is Yarn still a thing?

Does Yarn still a good product? Let's figure it out
10 August 2017   476

When npm@5 was just released this question was the first one I have googled. No doubts it comes to mind since new npm version introduced a lot of yarn’s features. In other words: should I still use yarn after installing npm@5?

Yarn features

Why do people use yarn in the first place? npm had some known issues. Well, we all have been there: downloading and installing packages for hours, resolution hell, not using essential --save and --save-dev by default, and many others.

When yarn was first released it solved many of these issues completely. It offered multiple improvements:

  1. yarn add saves a package not only to node_modules but also adds it to the list of dependencies in package.json. Think of it like yarn does not install a package into node_modules directory, it adds a package to your project
  2. yarn install worked in average from 2 to 3 times faster than npm installyarn changes how packages are downloaded and installed, that’s why it is so blazingly fast
  3. yarn install also checks for yarn.lock (or creates it), a special file where every single version is locked into a known state, what makes dependency resolution process deterministic
  4. yarn utilizes cache to make the installation process even faster. It is even possible to reinstall everything without internet connection when the cache is alive (saved me once)

This set of advantages at some point predetermined how the js package manager should look like. npm had to take the pace.

npm@5 breaks in

Keeping all that in mind the npm core team made a huge step towards the competitor. When the 5th major release was out a lot of people asked this question: should we still use yarn? The changelog for this release is inspiring indeed.

What are the key features that npm@5 brings to us?

Speed up: it is now competing with yarn and other package managers. Here’s a nice gif of the speed up, brought to you by one of the npm ‘s core members:

Determinismnpm now enforces the same workflow as yarn (and many other package managers). It generates package-lock.json to know what exact versions your project uses. It is worth mentioning that algorithms in yarn and npm differ. And npm has a solid advantage since it has better hoisting position across npm versions than yarn has across different version of yarn.

Sane defaults--save is now enabled by default. No more problems with that.

Cache: it was completely rewrittencacache and pacote living inside the new realization are fast and reliable. You can run this command to see it yourself:

git clone && cd cacache && npm i && npm run benchmarks

Default toolnpm is the default. Everyone uses it. Earlier it was like IE: a browser to download another browser. Jokes aside, this point is strong. You don’t need to have this one extra custom package manager.

But, really, is yarn still a thing?

The answer is: it depends.

My first attempt to install something with npm@5 was with my the most favorite 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 yarnas a primary tool.

But. Do not use both tools inside one team. It will lead to a disaster with package resolution and pollute your repository with extra files. Stick to something and use it.


npm is moving in a right direction (say hi to pip). It is pretty great already, but soon it will be even cooler. 

Provided by Elixir club.

ElixirLangMoscow Meetup #7

Meetup will be held on February 15th, Thursday, in Moscow, Pyatnitsky Lane 2
22 January 2018   348

Club ElixirLangMoscow invites all lovers of Elixir, Erlang and functional programming languages to the next meeting of our club. This time the event was decided to be held in the "Dear, I will call back" bar. Because, what could be better than listening to interesting reports for a glass of beer. And even in the company of friends!


We are waiting for two cool reports and a free microphone for those who have something to say.

Dmitry Rubinstein

Topic: “Introduction to Agala

Dmitry Rubinstein
Dmitry Rubinstein

The report will highlight the Agala framework - a platform for real-time interaction with third-party services. Currently, this platform has implemented bots for Telegram and Vk, which are used in the combat environment in our company. Let's analyze the main differences from the known solutions for creating bots on Elixir, consider the internal structure of the platform and learn how to support any necessary third-party service.

Dmitry Rubinstein

Alexandr Shorin 

Topic: “Apache CouchDB: more than a database with HTTP API

Alexandr Shorin
Alexandr Shorin

This will be an introductory report with Apache CouchDB and its ecosystem. Main features and capabilities. Details of the implementation of the replication protocol and why this is important. Forks: Couchbase, Cloudant - what are the differences and why should not they be confused with the original project. The history of clustering, what happened in the end in 2.0 and how it works. What is interesting about the new release and where the project is heading.

Alexandr Shorin 

As a pleasant chip, the bar will prepare an "Elixir" cocktail especially for us. Admission is free, everyone pays their bill.

The event has an age limit of 18+. Register for free.