Installing Node.js is pretty easy and we will be go through the steps involved in setting up Node.js on a Windows or Mac computer.
Open up the terminal on Mac, or the command prompt on Windows to confirm if you already have Node installed. This can be done by typing node -v or node –version on the command prompt. The version should be displayed as shown below, if it has been installed.
If not installed, open up the Node.js official website on your favorite browser to download the recommended version for Windows or Mac OS.
Double click on the downloaded file to begin Node installation. Follow through the instructions that appears on your screen. Confirm the version installed by repeating step 1, once the installation is complete.
Now it is time to write our first Node application. Create a folder somewhere on your computer. In my case, I have created a folder named FirstNodeApp.
Open up the created folder in your favorite code editor. This could be Atom, Sublime, Visual Studio code editor or any other one you are familiar with. Create a file named app.js inside the folder.
It’s now time to execute the code written in step 5. Go back to the terminal or command prompt, making sure that you are inside your current project folder. Type the command node app.js and press the return key. At this point, Node sends the file app.js to the V8 engine for execution and the result is the program output as shown below.