Я установил узел по следующей статье https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-%28Windows%29
Теперь я создал файл test.js в каталоге c: /cygwin/home/adminstrator/test.js, здесь находится папка моего узла.
Мой файл test.js
var sys = require("sys"),
http = require("http");
http.createServer(function(request, response) {
response.sendHeader(200, {"Content-Type": "text/html"});
response.write("Hello World!");
response.close();
}).listen(8080);
sys.puts("Server running at http://localhost:8080/");
Но в браузере, если запустить localhost: 8080 или 8.8.8.8:8080, содержимое не отображается ("hello world")
Пожалуйста, предложите, что мне делать?
Редактировать Ошибка при выполнении команды
$ node /home/Administrator/test.js
Server running at http://localhost:8080/
/home/Administrator/test.js:5
response.sendHeader(200, {"Content-Type": "text/html"});
^
TypeError: Object #<a ServerResponse> has no method 'sendHeader'
at Server.<anonymous> (/home/Administrator/test.js:5:15)
at Server.emit (events.js:27:15)
at HTTPParser.onIncoming (http.js:871:14)
at HTTPParser.onHeadersComplete (http.js:88:31)
at Stream.ondata (http.js:792:22)
at Stream._onReadable (net.js:762:27)
at IOWatcher.onReadable [as callback] (net.js:276:10)