【发布时间】:2016-12-28 05:22:39
【问题描述】:
我有一台 Linux 服务器(操作系统:Centos,ip:192.168.1.100),其中包含我想要调试的节点应用程序。
出于某种原因@office,我必须在远程客户端(ip:192.168.1.7)上工作,因为 Linux 服务器没有 GUI/浏览器。
我确实按照说明使用节点检查器,但没有成功...
这是我所做的:
$ 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
如果我打开客户端浏览器到http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
,我收到错误ERR_ADDRESS_UNREACHABLE。
如果我打开客户端浏览器到http://192.168.1.100:8080/?ws=192.168.1.100:8080&port=5858,结果相同。
如果(出于好奇)我打开 http://192.168.1.100:5858 我会得到:
Type: connect
V8-Version: 4.5.103.30
Protocol-Version: 1
Embedding-Host: node v4.0.0
Content-Length: 0
我确实已经在我的防火墙上打开了端口 8080 和 5858(为了安全起见)(在/etc/sysconfig/iptables 我有:
...
-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
...
)。
我错过了什么?
更新:
在@aleung 建议之后,我确实将web-host=0.0.0.0 标志添加到node-debug 命令行,但没有取得很大成功:我总是在浏览器中得到ERR_ADDRESS_UNREACHABLE。甚至来自192.168.1.7 客户端的telnet 192.168.1.100 8080
超时。相反,telnet 192.168.1.100 5858 回答:
Type: connect
V8-Version: 4.5.103.30
Protocol-Version: 1
Embedding-Host: node v4.0.0
Content-Length: 0
这可能意味着调试器正在侦听,但仍然无法从客户端界面访问:-(
【问题讨论】:
标签: javascript node.js debugging node-inspector