6

I have a Linux server (os: Centos, ip: 192.168.1.100) with my node app that I want to debug.
For some reason @office I have to work on a remote client (ip: 192.168.1.7), since Linux server has no GUI/browser.

I did follow the instruction to use node-inspector, without success...

Here is what I did:

$ npm --version
2.14.2
$ node --version
v4.0.0
$ npm install -g node-inspector
$ node-inspector --version
Node Inspector v0.12.3
$ node-debug myApp.js
Node Inspector is now available from http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
Debugging `myApp.js`
Debugger listening on port 5858

Then if I open my client browser to http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858 , I get error ERR_ADDRESS_UNREACHABLE.

The same result if I open my client browser to http://192.168.1.100:8080/?ws=192.168.1.100:8080&port=5858.

If (out of curiosity) I open http://192.168.1.100:5858 I just get:

Type: connect
V8-Version: 4.5.103.30
Protocol-Version: 1
Embedding-Host: node v4.0.0
Content-Length: 0

I did already open port 8080 and 5858 (to be on the safe side) on my firewall (in /etc/sysconfig/iptables I have:

...
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5858 -j ACCEPT
...

).

What do I miss?


UPDATE: After @aleung suggestion, I did add web-host=0.0.0.0 flag to node-debug command line, without great success: I always get ERR_ADDRESS_UNREACHABLE in browser. Even a telnet 192.168.1.100 8080 from the 192.168.1.7 client times-out. Instead, a telnet 192.168.1.100 5858 answers:

Type: connect
V8-Version: 4.5.103.30
Protocol-Version: 1
Embedding-Host: node v4.0.0
Content-Length: 0

Which probably means debugger is listening, but it's still unreachable from the client interface :-(

asked Dec 14, 2015 at 14:28
0

2 Answers 2

2

By default node-inspector web server listens on 127.0.0.1, only accept connection from localhost. You have to start node-inspector on your server with option --web-host=0.0.0.0:

$ node-debug --web-host 0.0.0.0 myApp.js

Then open your client browser to http://server:8080/?ws=server:8080&port=5858, where server is your server IP.

answered Dec 14, 2015 at 15:57
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks! I suppose you mean --web-host, since otherwise I get Cannot start web-host=0.0.0.0: not found: web-host=0.0.0.0... However, though your suggestion looks very promising, I keep getting ERR_ADDRESS_UNREACHABLE on the browser (after some seconds)... :-(
Note that --web-host=0.0.0.0 seems doing it's job, since netstat tells me node is now listening on 0.0.0.0:8080, instead of 127.0.0.1:8080 ...
@MarcoS It's --web-host, fixed.
0

node 7.x

node --inspect :file_name

answered Dec 1, 2016 at 5:45

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.