How to install Node.js, NPM and Yarn package manager

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi my name is Bill and today I'm gonna show you how to install nodejs node package manager and Yarn package manager so if you're not familiar with nodejs and NPM nodejs is a development platform for writing server-side JavaScript applications and also supports much of the tooling and automation when building modern front-end applications node package manager or NPM is the de-facto package manager and registry for open source JavaScript packages and is the default package manager for node J s so to install node J s we can just go to the node J s website nodejs org and here on the home page they have the download links available so we're gonna go with the recommended for most users version which is 12.16 dot 3 and we just click this green box and it's going to download the file we click the file when it's finished downloading and it's gonna open the node J s installer and we can quickly go through these steps here and we're going to put in our password and it's installing and that's it it's done so I'm just gonna go to the terminal and confirm that no js' and npm have installed so for nodejs i'm going to do no - be it's going to show me the version which is twelve dot 16.3 so that matches and for MPO or to do the same thing and the version is six 14.4 so that matches also so great that was easy so next we're gonna install yarn and if you're not familiar with yarn yarn was basically born from the facebook engineering team to solve some of the consistency security and performance issues they were experiencing with NPM while NPM is also evolved since yarns inception yarn is generally considered more performant so we're gonna go to the yarn website here and we go to the home page and then we click to getting started and then installation so it's worth noting if you notice that the URL here is classic yarn package.com so this is yarn one there is a yarn too but it's very new and at this point in time most developers are still familiar with yarn one and I myself have had a chance to diamond a yarn two yet which I may do in a future video so to install yarn one we can select our operating system or on Mac OS here and we're going to just keep the latest stable version selected so there's a few different options you can install with homebrew or Mac ports I'm gonna go just simply with this curl here I'm gonna copy paste that into my terminal and it's installing and that's it it's finished so real quick I'm going to show you how to initiate an application with NPM and yarn so here I'm just going to do NPM and knit and it's going to walk us through a few steps to add some details to the the package.json file it's gonna create for us so package name version description you can just hit enter to kind of go through these defaults and then you can edit this later so basically this is what the package.json file is going to look like the name of the app version description scripts so these are the script section is like scripts that I'll execute to start your application so like it could be like an NPM star or an NPM build or whatever I don't want to go into that now but you'll learn more about that as you play around with this so we're just going to say okay everything's good so let's just test installing a package real quick so say you wanted to build a react app you can do MPM install react and that's gonna go through install react package with this dependencies so now if we view the package.json file again we can see now here it's added react as a dependency so and it's also an added node modules directory and a package lock dot JSON so the package lock file is basically a more detailed version of the packages we have installed it'll have the exact version so if you were to share this project with another developer the package lock would install the same versions as you're installing so they're consistent from developer to developer so we can just peek into this node modules directory real quick and we'll see react here and some of its related dependencies okay so for yarn it's pretty much the same thing yarn in it and it's gonna kind of walk through those steps we saw with NPM so we can just enter press enter to kind of click go through those defaults and then you'll see here we now have a package.json so we can view that so yarn test at version etc so let's install react here also so for M p.m. it was NPM install react for yarn it's gonna be yard add react does the same thing so okay great and installed reacts so here again we have a node modules directory we have a our package JSON and Briard it creates a yarn lock file same thing that your unlock file is gonna have those exact versions so if you share this project with another developer it'll install the same versions and then we can peek into that node modules directory again same thing it's gonna have react and it's related dependencies okay well now you know how to install nodejs NPM and yarn I hope this video was helpful if you found this video useful please hit the subscribe button and turn on notifications so you'll be the first to know when u content hits this channel thanks a lot [Music]
Info
Channel: Unicorn Camp
Views: 5,494
Rating: undefined out of 5
Keywords: node.js, nodejs, node package manager, npm, yarn, macos
Id: qumhMfA7Sm4
Channel Id: undefined
Length: 7min 33sec (453 seconds)
Published: Mon May 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.