010101 I guess when you do a yarn command in your tutorials you are doing something a little different.
It has the same effect. npm
is the original package manager for Node.js that was born about 10 years ago. The company maintains the npmjs.com website, the npm public registry and the npm
terminal utility that is usually bundled with Node.js.
The npm history is quite bumpy, and there was a period where very little improvements were made to the npm
CLI. One of the main problems was that it was veeery slow to install packages (still faster than composer
though). It also had some other annoying bugs and weird behaviours.
So some alternatives were born, the most popular being yarn
by Facebook. yarn
still uses the npm public registry (it actually mirrors it on Facebook's servers) but provides a different terminal utility that does similar things, presumably better. It was a common opinion that it was true (and a fact wrt performance), at the time, but today npm
is much better than it was and has catched up on many aspects, so as far as I'm concerned there aren't many reasons to prefer yarn
over npm
today. I found npm
to be actually faster than yarn
in my limited testing.
In short, I would suggest to stick with npm
unless you have a real reason for not using it. There's a lot more documentation and resources about npm than yarn on the web.