我运行了一段代码,使用的是first.js
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8124);
// Console will print the message
console.log('Server running at http://127.0.0.1:8124/');
当我用Git Bash运行它时,它会给出期望的输出。但是在Node.js命令提示符下,它会给出Microsoft JScript编译错误。