Install Node.js on Windows

Tonight I was trying to install Node.js on Windows and couldn’t find any straightforward documentation. Reason is each new release of Node.js has multiple ways it can be setup. For instance, older versions required Cygwin and some people use a .exe file. None of these methods are optimal, so I’ve written a tutorial on how to install Node.js own Windows and test it in 6 steps with less than 10 minutes of your time.

Edit (10/19/2012): The below information is for Node 0.6 (including the code test sample). If you want to install the latest version just follow these simple steps and you should be good to go.

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

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.

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 c:\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.

Run Windows Command Prompt

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

You probably noticed that running node test.js output a message identical/similar to Server running at http://127.0.0.1:1337/. To verify node is working correctly leave your command prompt running in the background, then copy and paste http://127.0.0.1:1337 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.

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.

Post navigation

70 thoughts on “Install Node.js on Windows”

Thanks for this, I came across so many other examples with instructions mixed form different platforms and stopping short of the steps to verify.
Nice to see a straightforward and easy to follow guide.

The clearness in your publish is just cool and i can think you are a professional on this subject.
Well with your permission allow me to take hold
of your RSS feed to keep up to date with approaching post. Thanks one million and please
continue the gratifying work.

You are my hero. I looked at numerous attempts to teach this simple concept of installing node.js, from countless know-it-all geeks, and all of them are just too smart to understand the concept of simple instructions.

You hit the nail squarely on the head and delivered a superb tutorial! Much thanks.

It never ceases to amaze me how people who have been trained in the most advanced subjects loose sight of how to communicate with humans like me. After all, I am still a much superior machine when compared to any modern computer. So, why is it that my language is so sadly overlooked by those who seem to master, and understand, complex machine languages?

That is the real mystery of these times we live in!

I’m glad people like you are still around to teach humans how to be masters of machines, rather than how to teach machines to be masters of humans.

still misses the point as all these tutorials do: Installing Nodejs and Express.. which directories? where do you put your templates after the install? That is, your nodejs is for running web applications!! Static pages aren’t even mentioned by these folks… Common sense never prevails… Which npm, The commands you use will influence what and where something is installed. Everyones environment is different but… this makes believe that everyone is the same. Windows screws things up esp on 8 which has endless problems. For the most part you will get a page can not be displayed… and you will be wondering what happened.. has nothing to do with firewall or permissions … it has to do with where your working directory is after a default install of node and express!!!

Sorry Larry, this tutorial is just for setting up the bare bones basics (meaning not NPM packages like Express). If you are looking for something more complex on these subjects I recommend Node.js in Action http://www.manning.com/cantelon/

The reset step is something vital but you dont explain what to reset or how. We are talking about Windows, right? Im not Windows expert, but I guess Im not only one who have no clue whats reset in Windows world. If we were talking about router or some other chip, it would be clear. But generally, you dont “reset” PC. It sounds quite wild to reset when just installing software… O_o

Like it says reset the computer plain and simple. You need to rebuild the command prompt task list. Pretty much you add the necessary “node” and “npm” tasks when your computer reloads from scratch (as depending on how these are installed are only loaded at boot).

By “reset” I think the author just means “reboot” (shutdown the operating system and then start it again).

Also, there really isn’t anything magical about rebooting. Perhaps the author encountered a bug with an older version of node (this post is qute old now) or perhaps already a command prompt window open during the installation (which would not have had its PATH environment variable updated automatically without closing and relaunching it).

In case you’re curious, the MSI appears to have been created using WiX and you can see the source here.

In all honesty, thank you so much!! It was my first time setting up a server and this is totally like the holy grail of node.js installation tutorials. It’s really to the point and it works!

Just a heads up in case anyone encounters the following error on cmd: “node is not recognized as an internal or external command”. Simply type SET PATH=C:\Program Files\Nodejs;%PATH% on cmd and you’re good to go.

I have followed all the steps above. When I run the cmd, it shows that “Server running at http://127.0.0.1:1337/“, but when I copy the IP to the browser, the result is “503 Service Unavailable Failed to connect to server 127.0.0.1”

Only way I’ve been installing on my Windows computers is through the default Node.js installer package. They do have a .exe and some other fun files on Node.js’s download page http://nodejs.org/download/ (try at your own risk though).

It’s an wonderful tuts. It works for me that I can see the output Hello World in browser. But an issue worries me that is when I try to run node test.js in command promt, I got the following error/message (I do not what it is actually) that is,
Error: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at net.js:1135:9
at dns.js:72:18
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:901:3

Thank you very much for this tutorial. I struggled for hours and hours before finally arriving here. I tried using Cygwin Command to install NodeJs and I cannot even start talking about how many times it crashed during the MAKE command. I almost gave up until I found your blog and followed the instructions with ease and ended up having a smooth running server on my machine. I have one question now though:

You mentioned that older versions required Cygwin. Does that mean we do not need Cygwin on our PC anymore to have the NodeJs? I have Cygwin installed and if I don’t really need it, I guess I should remove it or something. Please help me with this question and I will appreciate so much!

All you should have to do is download go the the NodeJS home page and download the installer (see edit below first paragraph). I would avoid Cygwin (at all costs) on Windows if you don’t need it. For NodeJS it isn’t required.

That’s a great question as a majority of the documentation is out of date or terribly written. Even most of the books that have been released feel fairly rushed. The only reliable place you can find information is http://nodejs.org/api/ at the moment. Avoid most online tutorials, as they give incorrect information.

On the other hand I do recommend NodeJS In Action. Not trying to promote my publisher necessarily, but it really is a good book and written by the guy who created Expression for Node. Searched through Amazon to look for alternatives to recommend and can’t find any others I’m comfortable with suggesting.