LoginSignup
35
34

More than 5 years have passed since last update.

node-inspector で hubot をデバッグする

Last updated at Posted at 2014-04-03

hubotをデバッグする

nodeにはデバッグモードが用意されている。普通はこんな感じでデバッグモードに入る。

>node --debug hogehoge.js

でもhubotはbin/hubotのシェルスクリプトで立ち上げるので、この方法ではデバッグモードに入れない。この起動スクリプトの中身はこんなかんじ。

#!/bin/sh

npm install
export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"

exec node_modules/.bin/hubot "$@"

つまりnode_modules/.bin/hubotをexecできればいいらしい。

1.hubotをデバッグモードで立ち上げる

node_modules/.bin/hubotの中身はcoffeescriptなので、こんなコマンドでhubotをデバッグモードで立ち上げる。
必要があれば-a hogeのような引数もここで渡す。

>coffee --nodejs --debug node_modules/.bin/hubot -a hoge

2.node-inspectorを起動

>node-inspector
Node Inspector v0.7.2
Visit http://127.0.0.1:8080/debug?port=5858 to start debugging.

3.8080ポートをトンネリング(必要があれば)

>ssh -L 8080:localhost:8080 hori@hogehoge.jp

4.chromeでアクセス

kobito.1396523648.045696.png

35
34
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
34