How can I launch Chrome on Linux with remote debugging enabled? - linux

I don't know where Chrome is launching from or how to change its arguments.
I want to add --remote-debugging-port=9222 to the command line arguments
I tried *, dev, various paths:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"runtimeExecutable": "/var/lib/flatpak/app/com.google.Chrome/current/active/files/bin/chrome",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"urlFilter": "http://localhost:3000/*",
"webRoot": "${workspaceFolder}"
}
]
}
I always got an error. Chrome launches ok from the app toolbar. on launch, i tcant find chrome. on attach, it cant find port. I cant figure out or find on google searhc, how to use add argument for 9222. if i could do that i htink i attach would work.
i tried to laucn chrome from terminal but nothing worksd there either. chrome or google-chrome command not found. if i launch actual executable from actual path it wont launch b/c it cant find pieces of itself, even if i launch it from the folder its already in.
so the other similar questions wont give me a solution b/c they are for windows or mac or they suggest launching a command that doesn t wor k for me

Related

Visual Studio Code Opening in Browser

I downloaded VSC and recently for a course I opened jupyter notebook in ubuntu. Now when I try running my programs in VSC it keeps opening the browser in chrome and says "This site can't be reached: local host failed to connect". I looked at some websites and they said to delete
"action": "openExternally",
"pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
},
from the launch:json file. But when I open the launch.json file it says
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
Could someone please help me?
Thank you for your time
Just get rid of (or comment out) this entire section.
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
This is instructions to open chrome, so if you remove it, chrome won't open on run.
Add the following settings to run python normally -
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
For more details view the vs code page on launch.json config.

Node Debugging in WSL

I am using Windows 10 WSL in VSCode.
I have the extensions remote development, WSL, I have node installed, nvm as well.
When in work in a remote WSL and try to debug I don't have the Node option at all.
When I run the file I get:
No debugger available, can not send 'variables'
My launch.json is as follows:
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
}
]
}```
Can someone please help me fix it by adding Node.js option so I can properly debug?
Thanks a lot in advance!
Did you found the solution eventually?
I add similar issue, I could get things working only by specifying the node binary path explicitly.
get your node binary path by issuing:
which node
then add it to your launch.json config:
{
"name": "Launch Program",
"program": "${workspaceFolder}/helloworld.js",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node",
"runtimeExecutable": "/home/user01/.nvm/versions/node/v14.18.0/bin/node"
},
Still there is something is wrong going on, even though I simply the setup tutorial:
https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl

Debugging symlinked node modules with "chrome" type launch configuration

I've been using VS Code on macOS to develop a Vue.js app, with integrated Chrome debugging. This all works fine, but I also have a separate module I’m developing in conjunction, and it’s been symlinked in with npm link. This works great, except VS Code doesn’t let me set breakpoints in my modules’s code (they appear as “unbound” breakpoints).
The solution to this is to specify runtimeArgs in launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "vuejs: chrome",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/src",
"breakOnLoad": true,
"runtimeArgs": ["--preserve-symlinks", "--preserve-symlinks-main"],
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
},
]
}
But this still doesn’t work.The only examples I can find online show type node, not type chrome launch configurations. I’m not sure if Chrome debugging doesn’t support this option, or if there’s something else wrong.

VS Code Debugging for Node.js not working

For some reason the VS Code debugger doesn't stop at breakpoints in recently created node.js projects. In some of my older projects it works like a charm. I use the same launch files but it wont work. The debugger starts and runs through but it doesn't stop on any breakpoints.
Someone had the same issue? I recognized this after the latest update but I can't find some forum entries describing my problem.
I'm running the VS Code Version 1.50.1 and Node.js Version 14.13.0.
This is the launch file of an older project which works:
{
"type": "node",
"request": "launch",
"name": "Launch LN Star",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}\\NL_Star\\main.js",
"console": "integratedTerminal"
}
This is the launch file of a new project which runs but doesn't stop on any breakpoint
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}\\index.js",
"console": "integratedTerminal"
}
]
}
I'm glad to add some more information if needed and when I know how or where to look for it. But for now I don't really know where to start to fix this.
I guess I just missed something but I cant really find it!
Thanks a lot in advance for your help!

VS Code Debugger does not kill node process after stopping the debugger

I am working on a node.js application using express.js as a web framework listening on PORT 3000.
I am using VS Code v1.46.
My launch.json file is
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\WebApi\\index.js",
"restart": true,
"protocol": "inspector"
}
]
}
I am able to start the debugging session for the first time, but 2nd time onwards, I get error Error: listen EADDRINUSE: address already in use :::3000
This error is because VSCode didn't terminate the node.exe process created in 1st debugging session and so in the subsequent session node failed to start the express server on port 3000 as it is still in used.
Can anyone help me to configure VSCode to terminate node.exe process once I stop the debugger?
This issue started just last week for me, not sure why, maybe windows update.
Any way I found the following :
https://github.com/OmniSharp/omnisharp-vscode/issues/2387
where they say that if you add to launch.json
"console": "externalTerminal" or "console": 'integratedTerminal'
it will open a console for the process so that u can kill manually
It works fine with the Using the "preview" debug extension.
This is the launch.json for using that mode, just make sure that you put the correct command of your package.json.
{
"version": "0.2.0",
"configurations": [
{
"type": "node-terminal",
"name": "Run Script: start",
"request": "launch",
"command": "npm run start",
"cwd": "${workspaceFolder}"
}
]
}

Resources