Electron
Suprised not to see anything yet but this would be immensely helpful with Electron. Attaching to both the main and renderer process automatically, as well as any child processes!
I tried electron 3.0.0 and it looks like electron-quick-start work with following modifications:
- I updated electron to 3.0.0 in package.json,
Then just run ndb . in folder with quick start and start, and it looks like it works. :smile:
I tried similar with vscode, but it uses [email protected], something inspector related is broken there, I will take a look.
Oh does it not suffer from the “no console output transmitted to devtools” bug that’s acknowledged in electron? If so that would be a lifesaver. Will test it later today.
Unfortunately I am not familiar with this bug. If you could provide a simple repro case, I will investigate the root of problem and will do my best to fix it. Looking forward for your feedback.
Using Node 9.11 and 10.6 and ndb 1.0.25 electron-quick-start gives me this when I run ndb . and start the debug script electron --require ndb-inspect . after yarn install:
/Users/nw/github/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron[8082]: ../../vendor/node/src/inspector_agent.cc:496:bool node::inspector::Agent::StartIoThread(bool): Assertion `(client_) != (nullptr)' failed.
1: node::Abort() [/Users/nw/github/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
2: node::Assert(char const* const (*) [4]) [/Users/nw/github/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
3: node::inspector::Agent::StartIoThread(bool) [/Users/nw/github/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
4: _register_inspector [/Users/nw/github/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
5: v8::internal::StrDup(char const*) [/Users/nw/github/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
6: v8::internal::compiler::BranchElimination::ControlPathConditions::operator==(v8::internal::compiler::BranchElimination::ControlPathConditions const&) const [/Users/nw/github/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
7: v8::internal::compiler::BranchElimination::ControlPathConditions::operator==(v8::internal::compiler::BranchElimination::ControlPathConditions const&) const [/Users/nw/github/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
8: 0xba815d8463d
I tried again with an npm install and its different. It just exits right away:
https://v.usetapes.com/nPuJMwCEbB
Could you try to update electron verrsion to 3.0.0 in package.json of quick start app and run npm install again? And you do not need to add --require. Just run ndb from folder with quick start and run start from npm scripts sidebar.
Ah yea thats true!
But no console access at all unfortunately. Try adding a console.log somewhere in the main.js script and you can't find it anywhere or access the repl for electron.
Thanks, I will debug it and fix.
Not sure if it is the same problem, but I'm using electron 3.0.8 and ndb 1.0.26, and trying to debug, but I see nothing in the console, no output, and no pausing on debuggers or exceptions. in the sources tab.
I'm running it like ndb ./node_modules/.bin/electron src/annotator/annotator-entry-main/index.js:

The left side is empty console, and right side shows output in the terminal that I expected to see in the console.
Okay, if I run it as ndb src/annotator/annotator-entry-main/index.js without electron, then I start seeing output and debuggers work.
EDIT: oh, but then require('electron') doesn't work when doing it that way.
Yeah, looks like the same problem here.
Electron comes with the DevTools for Chrome built-in. Should be fairly straightforward to wire it up in a way that DevTools attaches to the Node instances and subprocesses automatically. Both myself and ak239 should be able to help, please point Electron folks here or connect us somehow!
Annoying bump, yes, but this would be lovely to have. Anyone we should point to this repo to help on the electron side?
I will focus on moving electron support forward in next couple weeks. First we need to fix crash that Nate mentioned awhile ago: https://github.com/electron/electron/issues/18872