C:\Users\fc\Desktop\js-basics\Projects>node net.js
给出此错误:
Error: connect ECONNREFUSED 127.0.0.1:8085
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8085
}
答案 0 :(得分:0)
两种解决此问题的方法。
1。您可以杀死正在监听8085 sudo killall node
的端口
2。您可以更改端口号。这是一个工作示例:
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!'); // This will serve your request to '/'.
});
app.listen(8000, function () {
console.log('Example app listening on port 8000!');
});