How to make your first program in Node.js

The first step is Download Node.js in the following website , choose the version according your operating system.

To write and compile our code we will use Notepad++, download it on the following website .

After the first step complete we will make our “Hello World!” program.

Open Notepad++ an write the following code:

console.log(“Hello, World”)

Then save your file as “Hello.js”.

Your Notepad++ file must look like this:

Notepad++ file

The next step is to open Node.js Command Prompt and type the following command and press enter.

cd path_of_the_file

The “path_of_the_file” is the directory where you saved your Notepad++ file (Hello.js).

The image below will ilustrate it better:

Command to change directory

After the directory change we will type the following command:

node Hello.js

This command will run the statement on the notepad++ file and show the output on the Node.js command prompt as it is shown on the image below.


Thats how we create our first program in Node.js.

Computer science student