我正在尝试编写一个 node.js 脚本,如下所示
var https = require('https');
var options = {
hostname: 'https://172.16.2.51',
port: 9090,
path: '/vm/list',
method: 'GET',
};
var req = https.request(options, function(res) {
res.on('data', function(d) {
process.stdout.write(d);
});
});
req.end();
req.on('error', function(e) {
console.error(e);
});
当我运行脚本时,我收到此错误:
{ [Error: getaddrinfo ENOENT] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo' }