Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging in VScode: "port already in use" error #276

Open
lorezyra opened this issue Feb 22, 2023 · 2 comments
Open

Debugging in VScode: "port already in use" error #276

lorezyra opened this issue Feb 22, 2023 · 2 comments

Comments

@lorezyra
Copy link

lorezyra commented Feb 22, 2023

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

Screenshot 2023-02-22 at 12 23 27

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

Screenshot

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?

@lorezyra
Copy link
Author

The obvious workaround is to have inspector bind on 127.0.0.1 and Hexo server to bind to localhost.

@stevenjoezhang
Copy link
Member

Do you mean that the default port of the hexo server conflicts with the debugger? You can specify a different port for hexo to avoid the conflict. I don't think this is a bug that needs fixing, as the port for either the debugger or the hexo server can be configured by the user. Whether it binds to 127.0.0.1 or localhost is not the main issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants