I am working on getting the VS Code debugger to attach to Chrome as part of my regular workflow.
I keep Chrome running all the time, and the highly-regarded VS Code Live Server extension opens my project in a new tab, which I like. I would like to be able to attach the VS Code debugger to this instance, but it looks like I have to start Chrome from the command line with
sudo /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
Several questions:
sudo
in the line above? Some sources do not have it.Thanks!
PS I see the related SO question for Windows.
The Sources panel is where you debug JavaScript. Open DevTools by pressing Command+Option+I (Mac) or Control+Shift+I (Windows, Linux).
Go to chrome://inspect#devices . Make sure that the Discover USB devices checkbox is enabled. Connect your Android device directly to your development machine using a USB cable. Your Android device may ask you to confirm that you trust this computer.
In the remote debugger window, click Tools > Options, and set the TCP/IP port number. On the command line, start the remote debugger with the /port switch: msvsmon /port <port number>.
There's a great tutorial on how to do this with Automator here: http://kynatro.com/blog/2018/01/11/chrome-debugging-in-vscode/
There are various Mac answers that used to work that don't anymore. I found one that does and built a double-clickable icon. I posted it on GitHub.
Apparently it's pretty easy to do using Automator, also.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With