Run node.js in windows

by graham

 

recent releases of node js, altough unstable, now come with windows executables (thanks to help from Microsoft) which means no more fiddling with cygwin to get it up and running on your machine. 

How to run node

1. Download node.exe from http://nodejs.org/#download 

2. Put this file into a folder, such as C:\node

3. Create a file called example.js

    and add this code:

    var http = require('http');

 

    http.createServer(function (request, response) {

      response.writeHead(200, {'Content-Type': 'text/html'});

      response.end('<b>Hello World from Node</b>');

     }).listen(1234);

   console.log('Server running at http://127.0.0.1:1234/');

4. Open cmd (not the exe)

5. Type cd C:\node

6. Type node example.js

You'll get the message Server running at http://127.0.0.1:1234/ and going to that link will show Hello World from Node

 

Comments

November 5. 2011 #

Thank you man, I executed node.exe directly and it didn't work out, when I did it through cmd, it worked correctly.

Thanks!

Wilson Colombia |

Comments are closed