DEV Community

Cover image for Are you a YARNer or a NPMer?

Are you a YARNer or a NPMer?

Charlie Say on June 10, 2022

An age old debate about package managers Each have their pros & their cons I personally prefer Yarn - I think it's general install...
Collapse
 
gktim profile image
gkTim

pnpm really fast installation ( in one monorepo I have 2,5 min vs 20 min in npm) and stricter in resolving dependencies. Also saves a lot of disk space if you have multiple projects.

Collapse
 
randwulf_magnus profile image
Randell Knight

I also use and enjoy pnpm. It's great for strictly resolving dependencies across the board, instead of recreating the wheel.

Collapse
 
andrewbaisden profile image
Andrew Baisden

Is it really that good would you ever go back to npm or yarn? Or do you still use them sometimes?

Collapse
 
gktim profile image
gkTim

If I can choose I always choose pnpm. But try them all and decided for your self :)

Collapse
 
nikfp profile image
Nik F P • Edited

PNPM all the way, unless for some reason I have to use something else for some reason.

  • Install a dependency another project is already using on the same machine > FAST
  • Clear node_modules and reinstall > VERY fast vs others
  • Raw install in a CI worflow or fresh OS distro > usually faster than Yarn, always faster than NPM in my experience
  • Workspaces just kinda works. I fought with workspaces in NPM and had all manner of issues with they way things were hoisted, dependency versioning issues, and even VS Code not recognizing imports from dependency packages I was writing in the same Monorepo. All gone with PNPM
  • MASSIVE savings in disk space, since each dependency version is stored in a global cache once, and then linked in to each project. This is also why things install faster, if a dependency has been installed on the OS before, nothing gets pulled over the network.

Right now, PNPM is my only globally installed dependency. Everything else can be explicitly listed in each project without having to be reinstalled for each project, which has saved me from some CI headaches I ran into with NPM previously. (Like forgetting to list typescript, and having it work locally because of a global install but NOT work on CI because there are no global installs)

I know I sound like a fanboi, but its my happy place.

Collapse
 
kerrickchan profile image
Kerrick Chan

I heard NextJS has dependence graph problem.🤔 it good and fast but not fully support some old project🥲

Collapse
 
marblewraith profile image
Matthew Rath

NPM, because i'm lazy and it's the default.

Collapse
 
jimmyrleung profile image
Jimmy Rios Leung

this

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I usually resolve the dependencies manually and download zips myself 🤣

Collapse
 
dillonb07 profile image
Dillon Barnes

Oh dear. I feel sorry for you. That must be a nightmare!

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I have a dial up connection which makes it even worse!

Collapse
 
kwiat1990 profile image
Mateusz Kwiatkowski

A true old school hardcore developer! 😂

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I joke but I can remember doing this! So many zip files, I can remember also when .min.js was a new choice!

Thread Thread
 
kwiat1990 profile image
Mateusz Kwiatkowski • Edited

Adam, I know and I can definitely relate, which makes it even funnier 😆.

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

I hope people don't feel bad for us being old 😂

Collapse
 
tmills9208 profile image
Tyler Mills

Neat, sounds very manual :p

I can think of using this for c++ or so, but im curious.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

It's only a joke, this is what they both do.
CPP has some package managers already I think, Conan or something, but there is no standard "package" last time I was working in CPP anyway

Thread Thread
 
tmills9208 profile image
Tyler Mills

I see :p

and good to know as well, I do plan to start looking into vsti development (synths and such for DAWs) which mainly uses c++

Collapse
 
ederchrono profile image
Eder Díaz

ni-er?
github.com/antfu/ni
I've so many projects with yarn, npm and pnpm that I always forget which project uses which. It is great to just run nr dev to turn on the dev server and start coding right away

Collapse
 
hmphu profile image
Phu Hoang

Yay!! I’m agree with you

Collapse
 
ivan_jrmc profile image
Ivan Jeremic

Never bet against the platform, I was full into yarn but since npm has now all yarn features even the commands are same there is no need for yarn anymore all my projects just feel super clean now working directly with npm. If you still on yarn I recommend try going back to npm it is awesom.

Collapse
 
fish1 profile image
Jacob Enders

NPM, because it has more community support. I'd rather have more compatibility between my tools rather than save 10 minutes on an installation I only do a few times a year.

Collapse
 
franciscomendes10866 profile image
Francisco Mendes

Between NPM and Yarn I prefer Yarn for having more intuitive commands in my opinion. Nowadays I don't think there are any big differences in performance between the two anymore, I think yarn should still win because of the cache. Because if it's a clean install, they're very close.

I've been using pnpm lately and I've found it super interesting and I've been loving it.

Collapse
 
brianburton profile image
Brian Burton

npm primarily because yarn increases our app build times by 50% causing them to time out. We have a complex NextJS app that with npm takes ~6.5 minutes to build on a 32GB machine. yarn pushes that past our 10 minute sanity limit.

Collapse
 
rrsai profile image
Roy R.

One thing to note is yarn 3 has zipped and thus trackable dependency cache, if that were something that would work for you.
No more network connection issues making your app unbuildable, or package maintainers taking their packages away leaving you with a broken app.

Collapse
 
brianburton profile image
Brian Burton

That sounds cool, just not sure how that would work in an automated build environment within a Docker container. Where does the cache get stored?

Thread Thread
 
kzqai profile image
Coco Ronalds

git add .yarn/
git commit

You can just track it in git along with your source files.

Thread Thread
 
brianburton profile image
Brian Burton

Cool! I'll check it out. Thanks!

Collapse
 
raguay profile image
Richard Guay

npm is the one I use. I just never got around to trying out yarn or pnpm, but I’ve used yarn once to compile a repo that was based on it. But, I use mask to run the tasks in npm and external moving things around or setting up the compile with other command line commands.

Collapse
 
pcjmfranken profile image
Peter Franken • Edited

NPM Has managed to catch up with Yarn in recent years with regards to feature set, and we don't really suffer from the "slow installation" problem Yarn claims to solve.

Sufficed to say we switched back to NPM

Collapse
 
chand1012 profile image
Chandler

I feel like I'm going to be the outlier here but I just kinda use.... whatever? My most recent personal projects have been using NPM (but mostly since the template I originally used was NPM) but my work uses Yarn. When I'm using Create React App it defaults to Yarn since I have both on my system so I just kind of go with it. I just kind of go with the flow I guess?

Collapse
 
zirkelc profile image
Chris Cook

I wanted to switch to Yarn v2, but its hoisting wasn’t supported by bundlers like Webpack and the Plug‘n‘Play zero install wasn’t supported Typescript.

I stayed with NPM for now, but it seems that I should give PNMP a try.

Collapse
 
suchintan profile image
SUCHINTAN DAS • Edited

I always prefer npm over yarn. Don't know why but I find npm quite optimized and yes maybe for some people yarn is faster. But when I look over to my experience they are quite same so don't find any edge or reason to use yarn when we have npm

Collapse
 
cadams profile image
Chad Adams • Edited

Last time I used Yarn berry (Which was a couple weeks ago) I couldn't get it to install private packages from GitHub packages because it doesn't use your .npmrc like PNPM or NPM. Unfortunately for my case it wasn't a drop in replacement for NPM. So I use NPM for now. I like the interactive upgrade feature of Yarn and the node_module structure that PNPM has.

Collapse
 
gabrieljm profile image
Gabriel José

NPM because there is no reason to change it, some people can say it is slow, but come on you are not in a race, and no it is not that slow, even more for a thing that you don't do every day. Another thing is, if you have so much dependencies that it is really slow using any tool you probably need to rethink the need of them. I could be wrong but that is what I think.

Collapse
 
casield profile image
Casiel Didriksson Muriedas

I've been using yarn berry (v 3.2.1) and it's awesome!
Always been a fan of yarn, it's really useful to just write yarn command instead of nom run command

Collapse
 
rcls profile image
OssiDev

I completely favor yarn after having huge amounts of permission issues with npm during installations.

Collapse
 
joelbonetr profile image
JoelBonetR 🥇

That looks like a misunderstanding on OS role/permission system 😅

Collapse
 
smitroshin profile image
Serghei Mitroshin • Edited

npm for the moment, because of npx.
yarn dlx at the moment works bad.

P.S. I tried to work on nx.js monorepo framework, and it doesn't support yarn v3.
I was surprised that some libraries/tech-stacks must something to do for supporting yarn dlx or other yarn v3 features.

And npm working from the box with all libraries without any issues :)

Collapse
 
mistval profile image
Randall

I use NPM. I have used yarn and I see the advantages, but I've never felt handicapped by NPM, and I like things that are built-in.

Collapse
 
akarachen profile image
AkaraChen

I use pnpm.
Since downloading npm dependencies is very slow in my area, pnpm's local cache helps me save a lot of time

Collapse
 
j471n profile image
Jatin Sharma

I use yarn but i am thinking to give a shot to pnpm 🤔

Collapse
 
colonelxy profile image
Harold Oliver 🛡️

I've been using npm and from this discussion, it seems I may maintain or try pnpm before i open my "mouth."

Collapse
 
gabrielpedroza profile image
Gabriel Pedroza

I'm sure there are differences to npm and yarn but I currently use yarn because it is faster at installing packages or at least, that's what i heard

Collapse
 
batuhan_ozkose profile image
Batuhan 🦊

yarn is always fav!

Collapse
 
andyhaskell profile image
Andy Haskell

Team Yarn. Maybe npm has gotten better since I used it but I've had wipeouts trying to install stuff that Yarn installs seamlessly

Collapse
 
rhythmsaha profile image
Rhythm Saha

I do use both npm and yarn. Most of the time i use yarn

Collapse
 
itsrakesh profile image
Rakesh Potnuru

Yarn

Collapse
 
jonaspetri profile image
Jonas Petri

I use npm. When I got started, I watched som tutorials that used npm, and now I’m used to it, so I have no reason to change.

Collapse
 
ethand91 profile image
Ethan

I'd say npm, but I sometimes use yarn.

Collapse
 
sean9999 profile image
Code Monk

I've come back around to npm. I think yarn should follow the way of io.js and fold into upstream

Collapse
 
uzair004 profile image
Muhammad Uzair

NPM, haven't tried yarn yet, I can wait few minutes while installing dependencies so don't think speed is that much of issue in NPM

Collapse
 
andrewbaisden profile image
Andrew Baisden

I prefer to use npm the most because it's usually the default. Otherwise my choice would be Yarn if the package has it as default.

Collapse
 
dnema09 profile image
Dheerandra Kumar Nema

NPMer

Collapse
 
drsensor profile image
૮༼⚆︿⚆༽つ

I prefer the Jurassic era
Deno meme

Collapse
 
l0uiscouture profile image
Louis Couture ❤️🏳️‍🌈🇺🇳⚜️

I use npm because it is the standards, I never gave too much toughts about it

Collapse
 
mrzer0 profile image
Yan Naing (ရန်နိင်)

yarn

Because the pronunciation is a bit similar to my first name. 😁😁😁

Collapse
 
denniarems profile image
denniarems

I'm a PNPMer

Collapse
 
kahy9 profile image
Josef Kahoun

PNPM or YARN 🙆‍♂️

Collapse
 
kissu profile image
Konstantin BIFERT

I use PNPM otherwise yarn, if I want to not really care about peer dependencies.
Even tho, the latest NPM is quite fast, it's still not as good.

Collapse
 
anuragvohraec profile image
Anurag Vohra

NPMer never needed yarn to date, so never bothered for yarn

Collapse
 
pierre profile image
Pierre-Henry Soria ✨

For various reasons, NPM is still my default one for 2022 😉 Although I need to give a serious chance to PNPM.. 🙂

Collapse
 
psypher1 profile image
James 'Dante' Midzi

PNPM, without a shadow of a doubt

Collapse
 
eshimischi profile image
eshimischi

Only Pnpm

Collapse
 
fevziyildizhan profile image
Fevzi Yıldızhan

ı usually use yarn

Collapse
 
yxsh profile image
Yash

yarn

Collapse
 
murunwas profile image
murunwas

pnpm ❤️

Collapse
 
ivadyhabimana profile image
Ivad Yves HABIMANA

I recently switched to Pnpm and I don't I will look back :)

Collapse
 
sylwesterdigital profile image
Sylwester Mielniczuk

you are not a package awaiting for a label, your question is insane

Collapse
 
mfp22 profile image
Mike Pearson

Adding an extra technology with new commands to make everyone on my team learn has to really be worth it. I prefer standard npm.

Collapse
 
ironcladdev profile image
Conner Ow

I use npm since it just helps to install packages mostly, that's all I need.

Collapse
 
chismo950 profile image
chismo950

yarn ui is more beautiful than npm

Collapse
 
crazybigworld22 profile image
Crazy Big World

I am an NPMer but would love to try out YARN

Collapse
 
vaivasap profile image
VaivaSap

Yarn for now. But after reading the posts of others I kinda want to explore pnpm :)...

Collapse
 
aoponcedeleon profile image
Allen Ponce de Leon

Out of habit, I only use NPM. Don't really know how each compares to the other

Collapse
 
ricktorrellas profile image
Rick-torrellas

PNPMer