2

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

Failed to Load Error

.vscode/launch.json:

{
    "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}"
        }
    ]
}

tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "sourceMap": true
    }
}

app/app.ts:

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

index.html:

<!doctype html>
<html>
<body>
    <h3>TypeScript Debugger</h3>

    <script src="app/app.js"></script>
</body>
</html>
4

1 回答 1

2

没有直接回答这个问题,但也许仍然有用:你知道你可以直接在 Chrome 中调试打字稿,包括断点吗?您甚至不需要安装插件。看这个截图:

在此处输入图像描述

于 2016-06-30T13:59:08.093 回答