localhost not working - chrome extension in vs code

13,463

I was experiencing the same issue.

Changing my launch.json file to the following solved the issue (Chrome is my default browser):

{
    // 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-node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}\\app.js"
        }
    ]
}

Where app.js was in my root folder of the workspace.

Here's what was the preivous launch.json file:

{
    // 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}"
        }
    ]
}
Share:
13,463
Abraham Gnanasingh
Author by

Abraham Gnanasingh

Loser | Steve Jobs | Apple Products | Web &amp; Mobile App Developer | Football | Music Lover | Rain | ...

Updated on June 09, 2022

Comments

  • Abraham Gnanasingh
    Abraham Gnanasingh almost 2 years

    In vs code, I have created a launch.json file in an HTML angularjs project. I am not able to launch the project in my localhost. It keeps on saying as Failed to load resource: net::ERR_CONNECTION_REFUSED (http://localhost:8080/).

    Project Structure:-

    Project => .vscode => launch.json
            => app
            => scripts
            => styles
            => index.html
    

    launch.json:-

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Launch Chrome against localhost, with sourcemaps",
                "type": "chrome",
                "request": "launch",
                "url": "http://localhost:8080",
                "sourceMaps": true,
                "webRoot": "${workspaceRoot}"
            },
            {
                "name": "Attach to Chrome, with sourcemaps",
                "type": "chrome",
                "request": "attach",
                "port": 9222,
                "sourceMaps": true,
                "webRoot": "${workspaceRoot}"
            }
        ]
    }
    

    Can someone help me to solve this? Thanks in advance