Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --auto-open flag w/ --inspect #12069

Closed
kentcdodds opened this issue Mar 27, 2017 · 11 comments

Comments

@kentcdodds
Copy link

commented Mar 27, 2017

Based on #7992, I'm filing this issue to start a discussion around supporting a flag that would open or refresh an inspect session. Because copying/pasting the URL is a suboptimal workflow. I believe there's a chrome extension that will basically do this, but it'd be really nice to have it supported natively.

@joyeecheung

This comment has been minimized.

Copy link
Member

commented Mar 27, 2017

Probably related: #11207 (If we decide to be vendor-neutral about the --inspect behavior...)

@jasnell

This comment has been minimized.

Copy link
Member

commented Mar 27, 2017

Just a thought, but perhaps this would be better suitable as a feature addition to node-inspect? That is, provide the ability to launch node-inspect with an option that opens a third-party debug client like Chrome as opposed to launching the command line debugger client.

example:

$ NODE_INSPECTOR=chrome node-inspect foo.js
@cjihrig

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2017

I don't think this is a good idea for core. We'd have to know how to start every set of supported debugging tools on every supported platform. It also wouldn't be very vendor neutral.

@kentcdodds

This comment has been minimized.

Copy link
Author

commented Mar 27, 2017

I tend to agree with @cjihrig and @jasnell. I would worry that this would bloat node unnecessarily. I would however like a blessed and official solution for this problem. Does such a solution exist?

@kentcdodds

This comment has been minimized.

Copy link
Author

commented Mar 27, 2017

I should say as a side note that the debugging story for node is definitely an area that needs work. Most people are still using console.log just because that's the path of least resistance. It's further complicated by the number of people using babel or TypeScript. If we could make the debugging story more straightforward, I think that would make things so much better for everyone.

@jasnell

This comment has been minimized.

Copy link
Member

commented Mar 27, 2017

Going with an environment variable approach where the value of the env var is required to include the launch pattern for the debugger would certainly provide a workable generic approach. e.g. NODE_INSPECTOR="chrome %u" where %u is replaced by the debugger URL on launch. It would be something that could be easily baked in to node-inspect without incurring the additional bloat of trying to teach it how to launch multiple tools

@Trott

This comment has been minimized.

Copy link
Member

commented Jul 30, 2017

/cc @jkrems

@jkrems

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2017

Because copying/pasting the URL is a suboptimal workflow.

I totally agree - it's not a good workflow. I wish we wouldn't be printing those URLs. If you're using Chrome Devtools, you can just go to chrome://inspect, click "Open dedicated DevTools for Node", and it will do all the connecting & reconnecting for you. :) Unless you use highly dynamic ports & IPs, you shouldn't have to copy & paste the URL.

I say highly dynamic because as long as you have a limited set of IP+port combinations, you can use "Configure..." to register them on chrome://inspect. And from then on we're back to "no copy&paste required".

@kentcdodds

This comment has been minimized.

Copy link
Author

commented Jul 31, 2017

Thanks @jkrems. That's the best way to do things now. We can close this. For what it's worth, that workflow didn't exist when I filed this issue. Glad the workflow is much better now :)

@kentcdodds kentcdodds closed this Jul 31, 2017
@jkrems

This comment has been minimized.

Copy link
Contributor

commented Jul 31, 2017

@kentcdodds Sorry, didn't mean to imply that the ticket wasn't totally reasonable at the time. :)

@d668

This comment has been minimized.

Copy link

commented Sep 20, 2017

Use Node.js V8 --inspector Manager (NiM) Chrome plugin, it opens Chrome automagically when I run node --inspect-brk app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.