Back when yarn was first released, the defining feature was yarn's lockfile, which sped up dependency tree resolution and thus the overall install ...
For further actions, you may consider blocking this person and/or reporting abuse
I now prefer NPM, but NPM does sometimes have problem with installing from package-lock.json.
Some other still missing features of NPM include,
Luckily, I now know an easy way to
npm-not-yarn
andyarn-not-npm
, with zero dependency.It is a best idea to pin dependencies and engines visibly for open source contributors, anyway.
From my own personal experience, I'm going to start using
yarn
.I started using
yarn
due to ReactNative and was blown away by the install speeds. It was easily 2-3 times faster thannpm
. I haven't tested it for other than React or ReactNative but I think I'll definitely be using it a lot more in the near future.Hi Neerja. I can tell
yarn
is faster. Recently I usednpm
for a fresh React Native project and... slower.Yarn is still faster that's all I can say.
try
yarn add express
and
npm i express
You can see the difference by yourself. Yes, I love it because it's faster but also it's easier to run scripts with yarn. You don't have to
npm run dev
just
yarn dev
I'm lazy; I hate to type another 3 letter wordπ
But having different lockfiles can put you in a lot of dependency issues.
So if I clone a project I'll look for the lockfile. And will use yarn and npm depending upon it.
So the thing is, yarn can install stuff faster.
Maybe time for me to go back to yarn, then!
I love yarn because it does parallel downloads making its 2-3 times faster than npm. Also you can run scripts easily with yarn
script-name
. I know the second one is not a huge thing but who wouldn't want to save some hundred keystrokes per dayYarn
is fasterFor us at Webiny, NPM is a no-go because it doesn't support workspaces.
You could say "use Lerna". Yes, we do use Lerna, but its hoisting capabilities and speed is far behind Yarn. We have 70+ packages in our monorepo, and Lerna just can't handle that with all the hoisting going on. And the results of hoisting between Yarn and Lerna are completely different.
For those who care to go into a deep analysis, there is a great article which compares npm, yarn, lerna and all the combinations of those, with benchmarks, etc.: doppelmutzi.github.io/monorepo-ler...
I'm really liking
yarn pnp
. The idea that you don't have to donpm install
or think at all aboutnode_modules
is awesome. Another great thing is that all your dependencies, as well as yarn itself, are stored inside your repo. I like the direction that yarn takes you into. It takes you away from reliance on npm, and allows you to be self-sufficient.pnp
is new to me... will have to see how it works. It looks like its resolution gets funky with typescript.I've been using TypeScript without much problem. If you're referring to TS in VSCode, you can use a custom workspace TS version (and pnpfy it) for the imports to get resolved properly.
It's a My dad is stronger than your dad discussion.
I pick Yarn, because it installs dependencies faster and I can use the
yarn
command-line tool to execute both dependencies and npm scripts. I frequently mess upnpm
/npx
/npm run
That's a good comparisonπ
I recently bricked the npm setup on my windows machine, immediately installed yarn and just continued coding. Being versatile enough to use both is fantastic!
I have found yarn to generally be faster in personal projects but haven't done the proper benchmarking to confirm!
"NPM is by far the most popular so why switch to yarn" is what 90% people would say in my opinion
That's kind of why I posed this question. I used yarn initially for the lockfile and moved back to npm when it added a lockfile. Want to understand why people still use yarn.
how bout pnpm tho?
I am going to add something, I prefer cdns because esmodules but I also prefer pika cdn