Debugger for Chrome: ERR_CONNECTION_REFUSED - visual-studio-code

Windows 10 x64 Professional
Visual Studio Code v1.26.1
Debugger for Chrome 4.9.0
I have the simple config (launch.json):
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080/index.html",
"webRoot": "${workspaceFolder}"
}
]
}
The launch.json file is located in the .vscode subdirectory of my project folder. Also my folder contains the index.html file.
I open my project folder in Visual Studio Code and press F5 key, but I get the ERR_CONNECTION_REFUSED error in the new Google Chrome instance. I.e. the browser can't to open my index.html page.
But this variant works fine:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against index.html",
"file": "${workspaceFolder}/index.html"
}
]
}
Why I have the problem with the localhost variant and how can I solve it?

I had the same problem this week. As far as I understand the first launch config (using URL and webroot) needs a local (f.i. node.js) web server up and running.
The second launch config "just" runs the local file(s).

Related

Can't run debugging in Visual Studio Code on Chrome OS

How do I run a .html file in VS Code on Chrome OS? It sais I need to add the absolute path to browser in a Json file.
Trying to open a .html file in VS Code on Chrome OS
U need to install a separate version of Chrome on VS Code then it will work. I just had the same problem and found the solution somewhere hidden on Reddit, but it worked :-)
sudo apt install chromium
Then you can add this to your .vscode/launch.json
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"runtimeExecutable": "/usr/bin/chromium",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"smartStep": true
}
]

Configured debug type 'hl' not supported

I have installed hash link on my linux machine (works on the terminal as expected) and upon pressing F5 from vscode for my heaps.io program, it says Configured debug type 'hl' not supported. So I tried searching for hashlink on the extensions market and found no results. I have copied my launch.json from the heaps.io tutorial website. What should I do?
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "HashLink",
"request": "launch",
"type": "hl",
"cwd": "${workspaceFolder}",
"preLaunchTask": {
"type": "haxe",
"args": "active configuration"
}
}
]
}
Where the launch.json file can be found
https://heaps.io/documentation/hello-hashlink.html
Ok I made it work! For some reason I had to copy all the required libraries from /usr/local/lib to /lib64 for vscode to launch my application through hashlink.
Also about the hashlink, I just installed the .vsix version of hashlink of version 1.1.12. The versions above that don't seem to work with the latest vscode version.

Visual Studio Code incognito mode when running a web project

I am having trouble launching a web project in Google Chrome incognito mode. I have tried making changes to the launch.json file but it's not working.
{
// 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",
"runtimeArgs": [ "--incognito"],
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}

VS Code launch.json attach to iexplore

I would like to debug my office-js application (with angular2) within VS-Code.
My launch.json is:
"configurations": [
{
"sourceMaps": true,
"type": "node",
"request": "attach",
"port": 4200,
"name": "Launch Program",
"outFiles": [
"${workspaceRoot}/*.js"
]
}
Currently I'm using Atom Editor with angular cli and "ng serve" command and VS Community Edition 2017 as debugger. It works with "Attach to Process" (iexplore) and I'm able to debug my Word AddIn.
For simplification I tried to move to VS-Code which -for my understanding- supports inline debugging.
In launch.json, "type" could be "node", "chrome", "edge", "firefox" but I didn't found iexplore which I would need in my opinion.
Thank you in advance for sharing your expierences.
There are a number of debuggers in the extension marketplace but I'm not aware of one for Internet Explorer.

VSCode and remote debugging in Chrome Developer Tools

Are there any step by step instructions for beginners to be able to see the output of VSCode code runs in Chrome Developer Tools?
Here is what I have done:
Installed "Debugger for Chrome" 3.1.7 extension with VSCode - extension installed OK, along with Live Server 1.6.7. Launch.json file shows up as below. However, even if I restart Chrome and VSCode, I can't see any logs in Chrome Developer tools.
Thanks!
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"webRoot": "${workspaceRoot}"
}
]
}