我在Android上运行node.js v0.11(通过https://github.com/paddybyers/node)。我试图尝试在这里找到的“Hello HTTP”示例:http://howtonode.org/hello-node,但是,我遇到了问题。Android上的HTTP服务器通过node.js请求错误
服务器启动正常,但只要我试图(通过访问http://localhost:8000/
)连接到HTTP服务器,我得到这个错误:
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/");
我该如何解决这个问题?
谢谢!
你能告诉我服务器的错误日志吗? – Rikky
这是服务器的错误日志。 – aegamesi