yunabe / tslab

Interactive JavaScript and TypeScript programming with Jupyter
Apache License 2.0
733 stars 45 forks source link

tslab crashes with "Unhandled 'error' event" #15

Closed yunabe closed 5 years ago

yunabe commented 5 years ago

Problem

If we run

import http from "http";
http.get('http://localhost:12345');

the kernel crashes with a message like:

      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:12345
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)
Emitted 'error' event on ClientRequest instance at:
    at Socket.socketErrorListener (_http_client.js:406:9)
    at Socket.emit (events.js:210:5)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 12345
}

Solution