FailedMathematician
FailedMathematician

Reputation: 467

node server.js is not working due to syntax error?

I am trying to learn node.js and like many others, the first step is like How to run server written in js with Node.js

However, my problem is syntax problem? (as follows) problemo

server.js

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/');

Upvotes: 0

Views: 396

Answers (1)

Jason Livesay
Jason Livesay

Reputation: 6378

That's a different program called Node. You may want to uninstall it, then install actual Node from here:https://nodejs.org/en/download/

Upvotes: 2

Related Questions