http-party / http-server

a simple zero-configuration command-line http server
MIT License
13.42k stars 1.48k forks source link

Server crashes on starting #828

Closed eafiontzi closed 1 year ago

eafiontzi commented 1 year ago

Environment Versions

  1. OS Type Windows
  2. Node version: $ node --version 12.14.0
  3. http-server version: $ http-server --version 14.1.1

Steps to reproduce

http-server

Expected result

Server starting successfully

Actual result

$ http-server
Starting up http-server, serving ./

http-server version: 14.1.1

http-server settings:
CORS: disabled
Cache: 3600 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  http://153.89.58.106:8080
  http://192.168.1.12:8080
  http://127.0.0.1:8080
Hit CTRL-C to stop the server

events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: read EBADF
    at Pipe.onStreamRead (internal/stream_base_commons.js:201:27)
Emitted 'error' event on Socket instance at:
    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: 'EBADF',
  code: 'EBADF',
  syscall: 'read'
}

Have tried versions 13.0.2 and older ones like 0.12.3 (was working with 12.14.0 in my previous laptop). Also have tried changing port, same result either way.

I finally got it to work with node version 17.0.0 but my app does not support that version. Is there something I can change to get it to work with node version 12.14.0?

zbynek commented 1 year ago

Does updating Node to anything lower than 17 help? Recent versions of http-server suffer from a bug with 12.15 that's not reproducible with Node 12.16

eafiontzi commented 1 year ago

Thanks for your reply. Got it working with node 12.17.0 (12.6.* not working either). Thankfully my app supports that version. Thanks again.

Not sure how I bypassed that bug in my previous laptop with version 12.14.0 and older http-server version 0.12.3...