Drdilyor
Drdilyor

Reputation: 1377

Cannot run web page in vscode

I am new to vscode.

My Problem may seem stupid.

I have 3 files: index.html, index.js and index.css.

i have the chrome debugging extension installed and cant figure out how to run my code

If i want to run / debug i am getting this error in chrome

chrome ERR_CONNECTION_REFUSED

i am sure problem is with the launch.json file. Here it is:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}"
        }
    ]
}

what i want is the index.html to be launched

Upvotes: 3

Views: 3025

Answers (1)

tHeSiD
tHeSiD

Reputation: 5333

Since you aren't running any webserver for it to look on localhost, you can't set the url to localhost but rather simply tell chrome to open the file from your workspace.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "${workspaceFolder}/index.html", // <-- This should be the path of the index.html file relative to the workspace
            "webRoot": "${workspaceFolder}"
        }
    ]
}

Upvotes: 4

Related Questions