【发布时间】:2013-07-14 23:46:29
【问题描述】:
我正在 Android 上运行 node.js v0.11(通过 https://github.com/paddybyers/node)。我尝试尝试在此处找到的“Hello HTTP”示例:http://howtonode.org/hello-node,但是遇到了问题。
服务器启动正常,但是当我尝试连接到 http 服务器时(通过访问http://localhost:8000/),我收到了这个错误:
net.js:1156
COUNTER_NET_SERVER_CONNECTION(socket);
^
ReferenceError: COUNTER_NET_SERVER_CONNECTION is not defined
at TCP.onconnection (net.js:1156:3)
我的代码和 Hello HTTP 例子一模一样:
//Load the http module to create an http server.
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(8000);
// Put a friendly message on the terminal
console.log("Server running at http://127.0.0.1:8000/");
我该如何解决这个问题?
谢谢!
【问题讨论】:
-
你能给我看看服务器的错误日志吗?
-
那是服务器的错误日志。
标签: javascript android node.js