18

スーパーバイザーを使用して node.js を自動リロードしています。

supervisor -w . app.js

ただし、スーパーバイザーに node.js プロセスをデバッグで実行させる方法がわかりません。たとえば、次のようなものです。

node --debug app.coffee

誰でもアイデアはありますか?

4

5 に答える 5

27

これも機能します (別の bash スクリプトは必要ありません)。

supervisor -- --debug app.js
supervisor -- --debug=7070 app.js
于 2012-04-24T10:28:11.047 に答える
9

このソリューションは *nix で機能します:

/usr/local/binまたは $PATH の他のディレクトリに移動します

$ cd /usr/local/bin

次の内容の実行可能スクリプト (node-debug など) を作成します。

#!/bin/bash
node --debug $@

実行可能にするには:

$ sudo chmod 777 /usr/local/bin/node-debug

これで、次のようにスーパーバイザーを実行できます。

$ supervisor -x node-debug script.js

PS: 切り上げるには:

su
echo '#!/bin/bash
node --debug $@' > /usr/local/bin/node-debug
chmod 777 /usr/local/bin/node-debug
于 2011-09-20T08:34:04.717 に答える
4

CoffeeScript サイトから:

--nodejs ノード実行可能ファイルには、--debug、--debug-brk、--max-stack-size など、設定できる便利なオプションがいくつかあります。このフラグを使用して、オプションを Node.js に直接転送します。

私はこれを試してみましたが、うまくいきました:

スーパーバイザー -- --nodejs --debug app.coffee

次のように他の引数を追加できます。

スーパーバイザー -w 。-n エラー -- --nodejs --debug app.coffee

于 2012-12-11T23:46:49.900 に答える
3

node-dev

node-dev on Github

"All arguments are passed on to the child-process. node-dev --debug server.js will debug your application, not the supervisor itself."

Create a "test.js" node.js script in $HOME/nodetest

First terminal (run node in debug mode, debug will listen on the port 5858, node-dev will reload changed files):

    cd $HOME/nodetest
    npm install node-dev
    node_modules/.bin/node-dev --debug test.js

Second terminal (start web inspector for a WebKit based browser, inspector connects to the port 5858 of the debugger and listens on the port 8080):

    cd $HOME/nodetest
    npm install node-inspector
    node_modules/.bin/node-inspector

Open this URL in a WebKit based browser (Chrome, Safari, etc.):

    http://0.0.0.0:8080/debug?port=5858

Click on "Scripts" and set breakpoints in your code.

于 2011-06-26T15:30:25.373 に答える
0

github ページ-xに記載されているフラグを使用します。node-supervisor

supervisor -w . -x 'node --debug' app.js

ただし、それはcoffeescriptでは機能しないため、使用する必要があります

supervisor -w . -x 'coffee --debug' app.js

于 2011-06-24T13:44:48.127 に答える