Node.js makes writing Event driven server side applications a piece of cake.

Node.js is a cross platform run-time that has been built on top of Chrome’s JavaScript Runtime which is specifically targeted for building scalable server side network applications.


Do you remember Ghost Blogging Platform? It uses Node.js. In this article let us just focus on how to install node.js and write a one line code.

Install Node.js on Windows

Both the source code and the installers are available for Windows and Macintosh Operating systems in the official Node.js download section.

The Installer is available for both 32-bit and 64-bit operating systems. I picked the x64 version which is around 5.9 MB

Once you have downloaded the installer, double click to start installing Node.js on your machine.

  • You should see the below setup screen, click Next

Install Node.js Welcome Screen

  • Check the “I accept the terms in the License Agreement” check box and click Next.

Accept License Agreement

  • Provide the path where you would like the Node.js to be installed or just leave the default path as it is.

Path where Node.js is to be installed

  • In the Custom Setup Screen you can choose which components can be installed, as of now just leave this as it is and click Next.

Node.js Custom Setup

  • Click the Install button to start your Node.js installation

Click Install to start the installation

  • Once the installation is completed you should see the below message displayed, click on the Finish button.

Node.js Installation completed successfully

Your First Node.js Program

Hurray, you have completed the installation successfully, now go to the start menu and under Node.js folder click on Node.js executable which will bring the command prompt as shown below. Now let us see whether the Node.js installed on your system is working fine or not by trying out a simple line of code.

Now type the below code in the console window:

console.log(‘Hello Artic Post Readers’)

Simple JavaScript on Node.js

You can now press CTRL + D or CTRL + C to exit the Node.js console.

Quick Tip: Do you know that you could execute the same line of code or for that matter any other JavaScript in your browser’s console tab?

JavaScript on Chrome Console

Executing External JavaScript in Node.js

You can also save the above code that we just executed from an external JavaScript file and refer the file name for execution in the Node.js command prompt which will give the same result.

Save the above line of code in a file called “NodeJavaScript.js”

External JavaScript for Node.js

Now from the start menu, under Node.js folder click the Node.js command prompt

In the command prompt first navigate to the path where your JavaScript file is located and then execute the file using the below syntax,

Node <filename.js>

refer the below screenshot

JavaScript on Node.js Command Prompt

Common Issues on Your First Node.js Program

If you were trying to execute some JavaScript in your node.js and you see three dots emitted and nothing else happens then there is something wrong with the code, you can just exit the current command execution by entering ‘.’ – dot and press enter

Node.js three dots

You should see the below message returned by the console:

Invalid REPL keyword

REPL means, Read-Evaluate-Print Loop. Now correct your JavaScript code and re-try again.

Hope this article was helpful for you to install node.js on your system and you were successful in writing your first line of code too. Let me know how it went.