Node.js is a platform built on Chrome’s V8 JavaScript engine for easily building fast and scalable network (especially server-side) applications.
Install Node.js#
Installing Node.js for Windows these days is super simple. Just download the Windows Installer and install it with the default features to a directory of your choice. That’s it.
Note that in most cases it shouldn’t make a difference if you pick the 32 or 64-bit version.
To check if Node.js installed correctly, open a PowerShell window or - if you’re feeling nostalgic - a Command Prompt window and simply type node
.
PS > node
>
You are now in an interactive Node.js shell and can start typing JavaScript commands. For instance try typing 3+2
. That’s right, you could use Node.js as a fancy calculator. Sweet.
PS > node
> 3+2
5
To exit the shell at any time press Ctrl
+ C
.
Hello World#
Of course usually you want to put your JavaScript code into a file and execute it with Node.js. So let’s just jump in the water and write a simple “Hello World” program.
Open your favorite text editor, create a file helloworld.js
and add the following line of code:
console.log("Hello World");
Save the file in the same directory where you installed Node.js and execute it with the node
program through node helloworld.js
.
PS > node helloworld.js
Hello World