无法使用Visual Studio Code和Chrome调试器扩展调试AngularJS应用程序

时间:2016-09-21 02:52:57

标签: javascript angularjs visual-studio-code

我在Visual Studio Code中使用Debugger for Chrome插件。

1)当我在Visual Studio Code中尝试launch调试器时,我收到此错误 - Failed to load resource: net::ERR_CONNECTION_REFUSED

2)当我尝试attach调试器时,我收到此错误 - Failed to load resource: the server responded with a status of 404 (Not Found)

我的最终目标是能够调试纯粹的AngularJS Web应用程序。

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Chrome against localhost, with sourcemaps",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:8080",
            "runtimeArgs": [
            "--new-window", //Open in new window
            "--remote-debugging-port=9222" //Open in port 9222 (standard chrome debug port)
        ],
            "webRoot": "${workspaceRoot}/app/"
        },
        {
            "name": "Attach to Chrome, with sourcemaps",
            "type": "chrome",
            "request": "attach",
            "port": 9222,
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}"
        }
    ]
}

注意:在启动调试器之前,我已确保没有正在运行的Chrome实例。我正在运行Windows 10

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题:启动vs代码调试器并获取ERR_CONNECTION_REFUSED。

然后我意识到vs代码调试器没有启动服务器。

一个简单的

$ npm start
在启动调试器之前在命令行中

,这解决了我的误解: - $