[英]Why does the nodeJS 'Hello World' example not work?
pasted a simple Hello World example from here to ubuntu machine.将一个简单的 Hello World 示例从此处粘贴到 ubuntu 机器。 But it does not work.
但它不起作用。 I get the output from console.log(), but navigate a webbrowser (firefox) to 127.0.0.1:8081 just outputs
我从 console.log() 得到输出,但是将 webbrowser (firefox) 导航到 127.0.0.1:8081 只是输出
'Problem landing page' The connection was reset The connection to the server was reset while the page was loading.
'问题登录页面' 连接已重置 与服务器的连接在页面加载时已重置。
var http = require("http");
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8081);
console.log('Server running at http://127.0.0.1:8081/');
Whats wrong with it?它出什么问题了?
Make sure to:确保:
If you have done already all this, make sure to go use Google, and not Bing Explorer, or Firefox如果您已经完成了所有这些,请确保使用 Google,而不是 Bing Explorer 或 Firefox
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.