错误连接ECONNREFUSED websocket

时间:2018-05-14 19:32:41

标签: javascript node.js websocket p2p

我试图使用ws包在node.js中构建p2p服务器但是在运行$HTTP_PORT=3002 P2P_PORT=5002 PEERS=ws://localhost:5004 npm run dev后我收到错误:

Listening on p2p port 5002
Listening on port 3002
events.js:165
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:5004
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
Emitted 'error' event at:
    at WebSocket.finalize (/home/ris/Desktop/gj-chain/node_modules/ws/lib/websocket.js:190:41)
    at ClientRequest._req.on (/home/ris/Desktop/gj-chain/node_modules/ws/lib/websocket.js:639:10)
    at ClientRequest.emit (events.js:180:13)
    at Socket.socketErrorListener (_http_client.js:395:9)
    at Socket.emit (events.js:180:13)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at process._tickCallback (internal/process/next_tick.js:178:19)
[nodemon] app crashed - waiting for file changes before starting...

我尝试重新安装依赖项,更改端口,终止所有端口上的进程(3002,5002,5004),但它没有用。我相信有一些依赖性,我使用的是ubuntu 16.04节点9.11 / npm 5.6.0版本。

0 个答案:

没有答案