ndb icon indicating copy to clipboard operation
ndb copied to clipboard

Electron

Open natew opened this issue 7 years ago • 12 comments

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!

natew avatar Aug 28 '18 04:08 natew

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.

alexkozy avatar Sep 18 '18 22:09 alexkozy

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.

natew avatar Sep 19 '18 16:09 natew

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.

alexkozy avatar Sep 19 '18 17:09 alexkozy

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

natew avatar Sep 19 '18 21:09 natew

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.

alexkozy avatar Sep 19 '18 21:09 alexkozy

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.

natew avatar Sep 19 '18 21:09 natew

Thanks, I will debug it and fix.

alexkozy avatar Sep 19 '18 22:09 alexkozy

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:

screen shot 2018-11-05 at 5 02 02 pm

The left side is empty console, and right side shows output in the terminal that I expected to see in the console.

trusktr avatar Nov 06 '18 01:11 trusktr

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.

trusktr avatar Nov 06 '18 01:11 trusktr

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!

pavelfeldman avatar Nov 22 '18 18:11 pavelfeldman

Annoying bump, yes, but this would be lovely to have. Anyone we should point to this repo to help on the electron side?

natew avatar May 23 '19 06:05 natew

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

alexkozy avatar Jun 25 '19 05:06 alexkozy