Rizary
Rizary3mo ago

Uncaught Error: The handle is invalid

Hi... So I've been using npm's package called http-server to simply serve my public folder during my development phase. I run the following code:
cd public && http-server -g -b --cors -p 9001
cd public && http-server -g -b --cors -p 9001
and it works nicely. Then I choose to use deno in my workflow but when I run the same command, I got the following error:
error: Uncaught Error: The handle is invalid. (os error 6): The handle is invalid. (os error 6)
at Stdin.setRaw (ext:deno_io/12_io.js:154:5)
at Duplex.stdin.setRawMode (ext:deno_node/_process/streams.mjs:232:23)
at Interface.[_setRawMode] [as _setRawMode] (ext:deno_node/internal/readline/interface.mjs:374:18)
at InterfaceConstructor (ext:deno_node/internal/readline/interface.mjs:309:22)
at new Interface (ext:deno_node/_readline.mjs:99:4)
at Object.createInterface (ext:deno_node/_readline.mjs:201:10)
error: Uncaught Error: The handle is invalid. (os error 6): The handle is invalid. (os error 6)
at Stdin.setRaw (ext:deno_io/12_io.js:154:5)
at Duplex.stdin.setRawMode (ext:deno_node/_process/streams.mjs:232:23)
at Interface.[_setRawMode] [as _setRawMode] (ext:deno_node/internal/readline/interface.mjs:374:18)
at InterfaceConstructor (ext:deno_node/internal/readline/interface.mjs:309:22)
at new Interface (ext:deno_node/_readline.mjs:99:4)
at Object.createInterface (ext:deno_node/_readline.mjs:201:10)
Is there any library that can replace my http-server?
1 Reply
bartlomieju
bartlomieju3mo ago
You might want to check out https://jsr.io/@std/http/doc/file-server
file-server - @std/http - JSR
@std/http on JSR: Utilities for building HTTP servers

Did you find this page helpful?