我收到此错误但无法解决此问题。
events.js:72
throw er; // Unhandled 'error' event
^
错误:连接ECONNREFUSED 在errnoException(net.js:901:11) 在Object.afterConnect [as oncomplete](net.js:892:19)
var http = require('http');
var options = {
host: 'localhost',
port: '8081',
path: '/index.htm'
};
var callback = function(response){
var body = '';
response.on('data', function(data) {
body += data;
});
response.on('end', function() {
console.log(body);
});
}
var req = http.request(options, callback);
req.end();