So, started learning node.js and tried the most basic thing in the world: A "Hello World" from the server.
the code is the following (copied from an actual book):
var http = require("http");
http.createServer(function(request, response) {
    response.writeHead(200, {"Content-Type": "text/plain"});
    response.write("Hello World");
    response.end();
}).listen(8888);
I hit the node.js executable, type node server.js and gives the famous SyntaxError: Unexpected identifier.
Tried looking for similar questions but couldn't find something that would help something as simple as what I'm trying to accomplish.

node server.jsfrom the command line, not inside the node REPL