1

I'm trying to execute a javascript code with node.js, and I get always two errors saying :

.port 1 is not active

.port 2 is not active

This my javascript code :

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

Any ideas ?

Raynos
  • 166,823
  • 56
  • 351
  • 396
VisaMasterCard
  • 1,666
  • 4
  • 18
  • 22
  • By the way I'm under `ubuntu` and I use `node myscript.js` to compile. – VisaMasterCard Jan 31 '11 at 16:28
  • very strange it should work. I would reinstall node correctly using this previous example from me. I think it explains it thoroughly http://stackoverflow.com/questions/4441798/how-to-use-redis-publish-subscribe-with-nodejs-by-event-driven/4446424#4446424 – Alfred Jan 31 '11 at 16:37
  • try `localhost` instead of `127.0.0.1` Sounds like there's an issue with how your router is set up and the like – Raynos Jan 31 '11 at 16:39
  • Always getting the same problem, even after changing 127.0.0.1 by localhost – VisaMasterCard Jan 31 '11 at 17:03
  • @Raynos that example just works for me. `$node -v 0.2.6` as it should! – Alfred Jan 31 '11 at 21:40

1 Answers1

0

Do you have anything else listening on 8124 already?

netstat -an|grep :8124
AndrewPK
  • 6,100
  • 3
  • 32
  • 36