I have the following code in a file called server.js.
var http = require(\'http\');
http.createServer(function (request, response) {
response.writeHead(200,
I think you're running the wrong node command.
Try locating or re-downloading your nodejs installation and add it to your path as the first directory. If you're running linux or unix you can try 'which node' to see what is being run.
Note that in some cases, the node.js executable is called nodejs so you may want to try
nodejs server.js
as well