0

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

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

i used which node, turned out its from /c/Program Files/Microsoft HPC Pack 2008 R2/Bin/node, not convinced if i should uninstall it I downloaded the binary and put it in the working folder, its working now, thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.