David Trejo’s Thoughts

« Back to blog

How to Install Node.JS on Windows

Update Here are the official instructions: http://github.com/ry/node/wiki/Building-node.js-on-Cygwin-(Windows) [link no longer broken]

 

I wanted to install node on my windows machine and I stumbled across this thread.

All you need to do is download the file below and then unzip it.

http://dl.dropbox.com/u/341900/nodejs/nodejs-0.1.99-cygwin-full.zip 

Then run bash.bat and do something of this sort:

 cd ~/Desktop

 nodejs-0.1.99-cygwin-full/node/bin/node.exe example.js

A big thanks to Simon Sturmer for posting the link!

mirror: http://dl.dropbox.com/u/10047/nodejs-0.1.99-cygwin-full.zip

 

The less easy way (will work even if node 0.1.99 gets old)

Go to http://nodejs.org/#download and download the zip file.

Download cygwin at http://www.cygwin.com/ (it is a dependency of node). The download link is at the top right. This could take a while.

Open cygwin via start > Cygwin > Cygwin Bash Shell

Navigate to the location of the zip file, using "ls" and "cd" commands. Mine is on my desktop.

When the zip file is in the current directory, run 

tar zxvf node<tab>

(Press tab after you type node to trigger auto-complete so there are no typos)

Congrats! Now you have an unzipped version of node on your desktop. Now to set up a version of python 2.4 or greater.

Download the latest version of python at http://www.python.org/download/ (it is a dependency of node)

When that finishes, go back to the Cygwin window you had open earlier. cd into the node directory you just unzipped.

Run

./configure
make
make install

You're done! Super congrats since you did it the hard way!

If you feel like runnning the tests, run 

make test

Hopefully I made the process less painful; please let me know if this could be improved in the comments.

Enjoy!

Posted July 1, 2010
Jul 02, 2010
julienboyreau said...
Hello,
I tried to do what you told :
1) Download and unziped the zip on my Desktop
2) Copy and save example.js in the nodejs-0.1.99-cygwin-full\node\bin dir
3) Run the bash.cmd
4) cd to the ../node/bin dir
5) do "node.exe example.js"
But I have an error "bash: node: command not found"

Please, do you have an idea where I am wrong ?

Jul 03, 2010
David Trejo said...
Hey Julien,
The basic idea is that you need to use the correct path for the node.exe file. If this is not correct, then the example.js code will not be run.

I hope that was helpful?
It may also work to simply drag the example.js file onto the node.exe file. I've heard this works but I have yet to try it out. I'll be able to help you out better when I get back to work on tuesday (comment again to remind me if there's still problems).

Good luck!
Jul 03, 2010
David Trejo said...
Correction: it may be the node.cmd file, you might want to try both and see what happens.
Jul 15, 2010
Santi8 said...
I am getting the same error a Julien following the easy way.
Must I download and install cygwin on my machine for this to work?
Jul 15, 2010
julienboyreau said...
Santi8,

Actually, thanks to DTrejo, I succeeded in running node.
The (only for now) method that works : dragging the example.js file and dropping it on the node.cmd file.

Aug 02, 2010
hbcyrus said...
very nice tutorial...and its working...but as I am new in node.js...I am stuck at adding additional modules..can u guide me??? I have install node.js using nodejs-0.1.99-cygwin-full.zip .
Aug 02, 2010
David Trejo said...
@hbcyrus, assuming you mean these modules: http://wiki.github.com/ry/node/modules, "installing" another module is as simple as putting the js file in your project folder and doing a

var mymodule = require('./mymodule');