How to Install NodeJS on Windows | Localhost

Step by Step Guide to Install NodeJS and NPM on Windows | Localhost. has created a Windows Installer (.msi) for NodeJS.

Steps by Step Guide to Install NodeJS on Windows | Localhost:
  1. Download Windows Installer (.msi) for NodeJS from NodeJS Official Website.
  2. Run the Installer (.msi installer) and follow the prompted steps in the installer.
  3. Congrats!, now you have installed NodeJS successfully with NPM and Node Modules.
How to check NodeJS and NPM Verison on Windows | Localhost:

Open either Windows CMD or Open Git Bash terminal, and type the following commands.

  1. node -v //it will show you installed version of NodeJS.
  2. npm -v //it will show you installed version of NPM (Node Package Manager).
Important Notes:
  1. NPM installed with NodeJS by default.
  2. Node Package Manager (NPM) – It lets you add Node Packages/Modules like ExpressJS, Nodemon, PM2, etc.
// Install express.js as dependency >> npm install express --save // Install nodemon as devDependency >> npm install nodemon --save-dev
Create a NodeJS Server on your Windows | Localhost:
  1. Go to any of your directory in any drive on your local windows machine.
  2. Now, create a file (for example) C:\projects\test.js.
  3. Now, put the below code in that file.
    var http = require("http"); http .createServer(function (req, res) { res.writeHead(200, { "Content-Type": "text/plain" }); res.end("Hello World\n"); }) .listen(3000, ""); console.log("Server running at");

    Note - You can change port from 3000 to any other if required

  4. Now, Open cmd (Command Prompt) and run following command
    >> cd C:\projects >> node test.js
  5. Go to the your browser and open this address in your browser:

Note: I have given above example to just show you how to create a NodeJS server locally. but it always recommended to create your NodeJS Projects using npm init