Install Node.js on Windows

Install Node.js on Windows

Node.js is a software platform that is used to build scalable network (especially server-side) applications. Node.js utilizes JavaScript as its scripting language, and achieves high throughput via non-blocking I/O and a single-threaded event loop.

Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software, such as Apache or Lighttpd, and allowing more control of how the web server works.

The ability to create an entire web application in JavaScript, both server-side and client-side, is particularly attractive to web developers.

If you want to install the latest version just follow these simple steps and you should be good to go.
Go to the Node.js home page nodejs.org

Click install to download the .msi installer package

Run it and follow the instrucitons, you now have NPM (node package manager) and Node.js installed

Reset your computer to get everything working in your command-line interface (CLI)

Windows Installation Instructions

To install Node.js on Windows is quite easy. You'll just need to grab an installer package from their website and run it. Well it isn't quite that easy, but its close.

Download Node.msi Windows installer

Go no Node.js's website and download the Windows .msi installer file. This is literally all you need setup everything.

Run Node.msi Windows installer

Install Node.js on Windows

nodejs-windows-2

nodejs-windows-3

nodejs-windows-4

Run Node's .msi file from anywhere on your computer. An installation window will appear. All you need to do is agree to and click okay on everything. If your Node.js install is corrupted, you can re-run this file and select repair to fix it.

Reset your computer

This is the step that everyone forgets. Once you've installed the .msi file you need to reset your computer. Failure to do so will prevent you from using Node in your command prompt. Wondering why? You need to flush Windows since its adjusting registry files and who knows what else under your computer's hood.

Post Install Node.js on Windows

Just because you've installed Node.js doesn't mean it works. In the next three steps, we'll quickly walk through creating a test file and running it.

Create a test.js file

var  http = require("http"); 
   
http.createServer( function (req, res) { 
  res.writeHead( 200 , {"Content-Type": "text/html"}); 
  res.write("<h1>Node.js</h1>"); 
  res.end("<p>Hello World</p>");
}).listen(3000); 
console.log("HTTP server is listening at port 3000.");

To make sure your Node.js install works on Windows, create a simple hello world script with the above code. Call it test.js and store it somewhere easy to access on your computer. A location such as E:\node\test.js will make your life easier when accessing the file via Windows Command Prompt. If you use a different location you'll have to adjust the following examples.

Install Node.js on Windows

Running windows command prompt to test node.js

Run your Windows Command Prompt and relocate to test.js's folder. Here you'll need to run node test.js. Running this line of code causes Windows to activate the file and output a message.

Verify install Node.js on Windows

node js hello world

You probably noticed that running node test.js output a message identical/similar to Server running at http://127.0.0.1:3000/. To verify node is working correctly leave your command prompt running in the background, then copy and paste http://127.0.0.1:3000 into your browser. This should display an image similar to the above picture. If it still isn't working walk back through the above steps or leave a comment below for more help.

Install Node.js on Windows

If you made it through the above steps there is nothing left to install Node.js on Windows. Your computer should run it fine and no further configuration is necessary.

0.00 avg. rating (0% score) - 0 votes