初学nodejs不久,在接触http模块时候,想监听一下 自己买的 云服务器,但是 listen 函数 报错:
const http = require('http');
const server = http.createServer((request,response)=> {
response.end("&");
});
server.listen(443,'48.109.76.190',()=> {
console.log("~");
});
C:\Users\Administrator\Desktop\nhub>node main.js
node:events:491
throw er; // Unhandled 'error' event
^
Error: listen EADDRNOTAVAIL: address not available 48.109.76.190:443
at Server.setupListenHandle [as _listen2] (node:net:1451:21)
at listenInCluster (node:net:1516:12)
at doListen (node:net:1665:7)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1495:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'EADDRNOTAVAIL',
errno: -4090,
syscall: 'listen',
address: '48.109.76.190',
port: 443
}
Node.js v19.1.0
errno:-4090 是哪里错误了, 端口是开好的, 监听localhost是可以的