DEV Community

Cover image for In 2021, Yarn vs. NPM Is there a better one?
martin rojas
martin rojas

Posted on

In 2021, Yarn vs. NPM Is there a better one?

So I know that this is one of those topics that's more about preference in 2021. I want to hear from both sides and see if my assumptions need to be updated.

Personally I favor Yarn and have done so for about 4 years working mostly on React projects in teams with 3 - 10 developers. Yarn and it's locked files removed issues of dependencies being a different version and sometimes causing weirdness. Similarly the CI versions have seem to create consistent builds. Finally the lock file is stable and only really changes when a package version is updated, while the last time I used npm the lock file updated a lot more often for no reason.

I would love to hear and have a discussion on the state of NPM and Yarn what the feelings are out there.

Top comments (4)

Collapse
 
mnismt profile image
Thanh Minh • Edited

Since v5, npm has improved a lot in speed. Now npm is faster than yarn. I tested it on cloud server as well as my PC and the result is pretty good for npm.

Collapse
 
dhaiwat10 profile image
Dhaiwat Pandya

I don't know if it's 'better', but there is pnpm.

Collapse
 
ishanpro profile image
Ishan Tiwari

Yarn is wayyyy better then npm atleast for me. It just throws npm out in every spec either performance or speed or whatever.

Collapse
 
josethz00 profile image
José Thomaz

yarn is much faster, at least for my PC