More WebStorm7 debugging woes
I searched through all the issues and tried everything suggested. Still no joy.
It's not that WebStorm won't debug node javascript. I was able to step into cli.js and then launcher.js. Debugging and stepping works fine until you get down to the call to child.fork() around line 108 in launcher.js:
if (childForks.length === 1) {
var childFork = childForks[0];
childFork.process = child.fork(
__dirname + "/runFromLauncher.js",
process.argv.slice(2),
{cwd: process.cwd()});
reportHeader_(childFork);
childFork.process.send({ <== call here disappears into the void
command: 'run',
cliArgs: childFork.cliArgs,
capability: childFork.capability
});
The process.send() call here just disappears into the either - nothing happens. No browser is launched. Breakpoints over in the process.on('message', function(m) {...} call in runFromLauncher.js don't get hit. Run without debugging and tests all run just fine.
@andresdominguez was mentioning some issues with debugging in the latest versions. Andres, is this the same thing you're seeing?
Hard to say if it's WebStorm debugger getting lost because a child process is launched or what. I was thinking the next step is native debugging down into the send() call in node.exe to see what's going on.
Looks to me like this commit cca82caab6ae444b368eebe040a69967d774737e with the move to forking off to a child process is what broke WebStorm debugging. I rolled our project back to 0.18.1 before the fork to child process and WebStorm7 works. Better work with JetBrains guys to see if they can keep the debugger alive when forking off child processes.
Also having problems with debugging using WebStorm and Protractor. When I try to debug in the IDE it says it has connected to 127.0.0.1:52345 and never hits the running selenium instance. As a workaround I am starting protractor with the debug parameter and then attaching the WebStorm debugger with a "Node.js Remote Debug" run configuration. Clumsy, but seems to work.
I have the same problem on both Windows 7 64 bit and also MacOS Mavericks. Running version 0.20.1 on Windows.
Yes, it is the same issue I was telling you about.
ptor: 0.20.1 node: 0.10.25
This is how webstorm / intellij starts the debugger (console output).
/home/andresdom/.nvm/v0.10.25/bin/node --debug-brk=54377 --nolazy node_modules/protractor/lib/cli.js protractor-config.js
debugger listening on port 54377
------------------------------------
PID: 10358 (capability: chrome #1)
------------------------------------
debugger listening on port 54377
Failed to open socket on port 54377, waiting 1000 ms before retrying
Failed to open socket on port 54377, waiting 1000 ms before retrying
Failed to open socket on port 54377, waiting 1000 ms before retrying
...
BTW, debugging in the Node tools for Visual Studio also doesn't work - probably for the same reason.
Hm, given the command line that @andresdominguez shared, I'm not sure if there's a way to do this. We could start up the v8 debugger on a different port in the child process, but webstorm won't know which port to listen to then. You won't get the failures, but it still won't stop on the debugger.
Relevant issues: http://stackoverflow.com/questions/16840623/how-to-debug-node-js-child-forked-process
Perhaps someone more familiar with webstorm would know if it's possible to tell webstorm about the second port (the debugging port of the child process?)
EDIT: looks like this is possible, but only with remote debugging, which is meant to connect to a preexisting server. That's not very helpful - so going with a one-process solution.