如何解决 "Firefox can't establish a connection to the server at 127.0.0.1:8081"
how to resolve "Firefox can't establish a connection to the server at 127.0.0.1:8081"
var http = require("http");
http.createServer(function (request, response){
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('hello suneha\n');
}).listen(8081);
console.log('server running at http://127.0.0.1:8081/');
当 运行 节点 js 程序 1
时,浏览器出现错误
这里是你用错名字的问题respponse
应该是response.
http.createServer(function (request, response){
可能是其他进程正在使用 8081 端口。
我试过不同的端口号,它工作正常enter image description here
var http = require("http");
http.createServer(function (request, response){
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('hello suneha\n');
}).listen(8081);
console.log('server running at http://127.0.0.1:8081/');
当 运行 节点 js 程序 1
时,浏览器出现错误这里是你用错名字的问题respponse
应该是response.
http.createServer(function (request, response){
可能是其他进程正在使用 8081 端口。 我试过不同的端口号,它工作正常enter image description here