Not able to debug in TypeScript - VS Code
<p>I am unable to open the localhost and unable to debug TypeScript file in VS Code because of some error. I have set <strong>target</strong> to <code>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--remote-debugging-port=9222"</code> in <strong>Chrome Properties</strong>. I got the error as <code>[debugger-for-chrome] Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9222</code>. Refer the following image for error after killing all <code>chrome.exe</code> processes. Can someone help me to solve this issue? Thanks in advance. </p>

<p><a href="https://i.stack.imgur.com/hkGSl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hkGSl.png" alt="Failed to Load Error"></a></p>

<p><strong>.vscode/launch.json:</strong></p>

<pre><code>{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch index.html with sourcemaps",
            "type": "chrome",
            "request": "launch",
            "file": "${workspaceRoot}/index.html",
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}"
        },
        {
            "name": "Launch localhost with sourcemaps",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:3000",
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}"
        },
        {
            "name": "Attach with sourcemaps",
            "type": "chrome",
            "request": "attach",
            "port": 9222,
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}"
        }
    ]
}
</code></pre>

<p><strong>tsconfig.json:</strong></p>

<pre><code>{
    "compilerOptions": {
        "target": "es5",
        "sourceMap": true
    }
}
</code></pre>

<p><strong>app/app.ts:</strong></p>

<pre><code>var x = 1;
console.log(x); //made debugger here in VS Code
</code></pre>

<p><strong>index.html:</strong></p>

<pre><code>&lt;!doctype html&gt;
&lt;html&gt;
&lt;body&gt;
    &lt;h3&gt;TypeScript Debugger&lt;/h3&gt;

    &lt;script src="app/app.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>