DEV Community

Madza
Madza Subscriber

Posted on

NPM vs Yarn: which package manager do you use?

Two popular package managers in the ecosystem are NPM (Node package manager) and Yarn (package manager created by Facebook).

Which one do you use and why do you prefer it over the other?

Latest comments (22)

Collapse
 
al5ina5 profile image
Sebastian Alsina • Edited

Yarn! It's way faster and has much prettier output.

Collapse
 
andrewbaisden profile image
Andrew Baisden

My preference is to use npm because I have never really experienced that many problems with it. I have used yarn a few times and it feels like its almost exactly the same as npm. And because npm seems to have more usage I have just stuck with it for now. Unless I can see some real significant performance gains they seem to be more a less the same. It is like comparing React to Angular its just two different ways of doing the same thing.

Collapse
 
al5ina5 profile image
Sebastian Alsina • Edited

This was exactly what I thought until I used yarn. Most of the tutorials and open source projects online use npm in their installations guides, so I assumed it was better. I now use yarn always because it’s much speedier and has nicer output.

Collapse
 
ehsan profile image
Ehsan Azizi • Edited

For me doesn't really matter which one to use as long as the real problem exists which is the node_modules folder, unfortunately after over a decade of NodeJs this problem still isn't fixed, why should I have more than 30k of dependency files for every simple Create-React-App app, why there is not a centralized dependency management solution like C#, Currently I have a few React and Angular projects and the size of node_modules folders are almost 5GB and millions of files, I know there are some solution for this like PNPM but they are not without problems and also not as straight forward.

Collapse
 
axelledrouge profile image
AxelleDRouge

I have recently tried yarn and liked it mostly for its speed and for its clear explanations of what is happening

Collapse
 
nolyoi profile image
Nolan Mayersky

I prefer Yarn. Not sure why tbh. Feels a little cleaner to me. But I bounce between the two.

Collapse
 
easrng profile image
easrng

I use npm because I'm lazy, but i reccomend pnpm.

Collapse
 
gsin11 profile image
Gurpreet Singh

I am using it in my current project where we also implemented yarn workspaces, which is quite easy to maintain with yarn instead using it through npm.

Collapse
 
awesomeironman profile image
Cyrus Gracias

I prefer yarn over npm because of the performance benefits
Performance while installing packages
As well as
Its commands are shorter, take less keystrokes to run

Collapse
 
pavelloz profile image
Paweł Kowalski

npm. Because it works.

Collapse
 
ducdev profile image
Duc Le

Yarn workspace is the game changer for monorepo.