This course has been updated! We now recommend you take the Introduction to Node.js, v2 course.

Check out a free preview of the full Introduction to Node.js course:
The "yarn" Lesson is part of the full, Introduction to Node.js course featured in this preview video. Here's what you'd learn in this lesson:

Scott introduces another package manager created by a different company that does similar things to npm.

Get Unlimited Access Now

Transcript from the "yarn" Lesson

[00:00:00]
>> Speaker 1: Yeah, and there are other tools that aim to do the same thing. So one of them is gonna be Yarn. That's the one that I use. So I use Yarn. Yarn is literally the same thing as NPM, but it was made by Facebook. No, I don't like Facebook.

[00:00:14] I'm not trying to sell you on Facebook. I just really like Yarn. It literally does the same thing as NPM. It even has the same command names, cuz they want it to be easier to switch. And that's basically what I use. So, I would say yarn. Some of the differences there, you could do yarn install, but I do yarn add.

[00:00:31] And I'll just add the name of it. Yarn add lodash and it will do the same thing. The difference with yarn is that up until recently, it's just been faster cuz it uses a CDN to cache things, whereas, at the time, when Yarn was made, NPM didn't do it.

[00:00:45] NPM's doing it now, and they're actually pretty fast. And also, Yarn, at the time, was the only project that had some type of locking mechanism where I can lock reversions of dependencies from changing. That way, not only did I have a package.json that downloaded the modules, but I also was able to freeze them in times, only this version, this module and nothing else.

[00:01:06] So Yarn did that. NPM does that now too with the NPM shrink wrap. Or they might even have a lock file now. But I haven't used NPM in a while.
>> Speaker 2: Packagelog.json?
>> Speaker 1: Packagelog.json, there you go. So NPM does now, so it's funny how this community works. People will like, fork things, make things.

[00:01:20] And then the original creator was like, really? Well, we're gonna make ours better too. That's literally what happened with NPM. Yarn came out, NPM was just like, wow, we can do that too, and overnight, they just did all this stuff. So pretty legit.