1

I would like to use node-inspector to debug an application written with Derbyjs, but have not had much success. I think the problem is that derby runs in a child process. My code loads like this:

derby.run(function () {
...
});

When I start the app with node-inspector, I see none of the normal startup output I write to the log. But also, when I go to the url that node-inspector outputs,

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

nothing happens. I've used node-inspector before, and never really had to do much of anything to get it working. Not sure what to do to get it working.

Scheiner
  • 87
  • 1
  • 6

2 Answers2

0

Yes you are right.

The problem is that derby forks processes and they are not assigned a different debugging port. So in theory you can only debug the first derby "app".

I made a pull request to work around this, but it hasn't been merged yet.

Please visit https://github.com/derbyjs/derby/pull/472 and merge it in your local project. After that you'll be able to debug using node-inspector.

Master process is assigned

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

App 1

http://localhost:8080/debug?port=5859

...


Then use --debug flag in node

node --debug server.js

Using node-inspector

node-inspector --debug-port=5859
Rui Gonçalves
  • 1,164
  • 8
  • 15
0

Derby doesn't fork processes if NODE_ENV=production. So of course you can try this workaround but I suggest not to use derby.run in your server-part if you want to use node-inspector.

derby.run is just a wrapper. you can throw it away like this:

  derby.run(function(){
    // inside code
  });

  // to just --->

  // inside code
zag2art
  • 4,869
  • 1
  • 29
  • 39