Node JS Tutorial for Beginners #2 - Installing Node JS

Kiki's knowledge delivery
10 followers
12 Video Views·Oct 22, 2022
Yo, what's happening guys, welcome to your second node.js tutorial and in this video
I'm going to show you how we can install node.js on our computer
Alright, then so the first thing we want to do is head over to nodejs.org
I'll leave the link down below and you want to download one of these versions of node.js to your computer now
There's two to choose from on the home page
There's version 4.4.4 or 6.2
And the difference is that this 4.4.4 on the left is the latest stable version
This one on the right, although is the latest version with all the new features. It may not be stable
Okay, so for most of you I'm going to suggest this one on the left
So go ahead click that and download it to your computer go through the installation steps. Don't change anything
It will take you about three minutes and then node.js will be installed
I've already gone ahead and download this one just for the fun of it
So now that we've installed node.js on our computer, how do we actually know that it is installed?
well, what you want to do is come down here and search for cmd which is going to bring up the command prompt and
Then in here just write node
Space hyphen V and this is going to tell us what version of node.js is installed
So if you've been successful in installing node.js then it's going to throw back the version there to you
You can see mine is 6.2, but yours might be different
Okay, so when I said in a previous tutorial that we're going to be using the command line
This is what I meant whenever we want to run a node application or do something in node
We're gonna write a command in this command line right here
But I find this a little bit cumbersome because I'm going to be working in atom this text editor and I don't like
Constantly switching between the two, although it's not that hard
So what I've done is go ahead and download it a package in atom which has given me this terminal at the bottom
So now I can just write node commands in here instead of switching to this thing
okay, so to do that what you want to do is go to file then go to settings and
You want to go to install to search for this terminal now?
I've already got it installed and I'm going to show you what that's called. It's called platform
So just search for this in the install section right here and then install it on to atom
Okay, so now that we've done that you'll notice we can just write anything
We would do in the other one for node in here instead
So if I put node hyphen V again in here press ENTER
It's going to do the same thing and tell me I've got version 6.2 installed
Okay, cool. So you'll notice now on the left. I've got open the files that I uploaded to github
So I downloaded those and then I right-clicked on here went to add project folder
Then navigated to where I downloaded those files from github and opened them up into atom
So at the moment, we've got this public folder and the assets and this is all going to be for that to-do list application
We make later on we're not going to use them just yet
But what I'm going to do is come to the top folder and go to new file and I'm going to create a new file
Called app.js just to test out node
Then inside here. I'm going to say console.log and I'm just gonna put a little message
Hey ninjas in there like that and save it
So now if I want to run this application or this file in node, what do we do?
Well, I come down to the terminal and I write node space and then the file name
which I want to fire or execute which is app.js and
Actually, I can just leave off the JS I can just put up the name of the file
Click enter and that's going to run this file for you. And you'll see that this is logged down here to the terminal. Cool
However to do this you'll notice I am in this directory in the terminal node.js playlist where this
File is found. So you'll need to be there as well
Wherever the file is found to run it you have to be there or give the full path to the file
So to change directory if you're in a different directory in here
You just do CD and to go up a directory you do dot dot that's gonna bring me up a directory
You see it's gone to YouTube sites now
Now to go back into a directory that you're currently in like to choose a folder from the directory
You're currently in you say CD then the folder name so I could say node
Hyphen JS hyphen playlist and that's going to go back into this folder
Okay, so make sure you're in the folder where your app dot JS is and then you can run it with node
Like so, okay
Cool. So now we've successfully installed node and we've run our first node application, even though it's pretty pants
We're going to move on to some more advanced stuff over the next few tutorials
So until then if you have any questions, leave those down below
Don't forget to share subscribe and like and I'll see you in the next video
