Debugging in VScode: "port already in use" error
lorezyra opened this issue · comments
Problem
hexo server fails to bind to 127.0.0.1
while using node inspector. If you explicitly define the IP and port the same as that configured for Node Inspector, it will fail to start.
$(which hexo) clean && node --inspect-brk=4001 $(which hexo) server -i localhost -p 4001 --debug
However, if you don't define the IP and leave it to defaults, everything starts, but the browser doesn't reach the server over 127.0.0.1
...
$(which hexo) clean && node --inspect-brk=4001 $(which hexo) server -p 4001
Related issue
Environment
-
MacOS 13.2.1
-
node: v19.6.1
-
Hexo:
- hexo: 6.3.0
- hexo-cli: 4.2.0
- os: Darwin 22.3.0 darwin x64
- node: 19.6.1
- v8: 10.8.168.25-node.11
- uv: 1.44.2
- zlib: 1.2.11
- brotli: 1.0.9
- ares: 1.19.0
- modules: 111
- nghttp2: 1.52.0
- napi: 8
- llhttp: 8.1.0
- uvwasi: 0.0.15
- acorn: 8.8.2
- simdutf: 3.1.0
- undici: 5.19.1
- openssl: 1.1.1t
- cldr: 42.0
- icu: 72.1
- tz: 2022e
- unicode: 15.0
Expected behavior
Server should work Node inspector. How else does one troubleshoot issues if it won't bind on the same domain (IP) and port? IP alias?
The obvious workaround is to have inspector bind on 127.0.0.1
and Hexo server to bind to localhost
.