Node.js not working on Windows XP machine

5.6k views Asked by At

I am just getting started with node.js and I have followed multiple tutorials to get it working on my Windows XP machine.

Downloaded the msi and installed with no issues, opened a command prompt and typed node -v and nothing displays. I created a folder and made a JS file with console.log('hello'); in it, changed to that directory and typed node hello.js and nothing shows.

I then added this code to the hello.js file:

var http = require('http');
    http.createServer(function (req, res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Hello World\n');
    }).listen(1337, "127.0.0.1");
    console.log('Server running at http://127.0.0.1:1337/');

and ran the file from the command line again, it paused briefly and then again displayed nothing.

Been through 10 different tutorials on 10 different sites and can't find a thing to answer this question, even all the information here was no help at this point.

I have also checked the path and it is fine and rebooted the machine just in case.

Seriously stuck!

1

There are 1 answers

5
guergana On

You need to set your path to node (Environment Variable). Check the following address:

http://www.hacksparrow.com/install-node-js-and-npm-on-windows.html

This is necessary for running node from any folder in the system.

Or you can add node as an enviroment variable in Windows XP's settings:

https://support.microsoft.com/en-us/kb/310519