【发布时间】:2016-11-01 18:38:25
【问题描述】:
由于某些错误,我无法打开本地主机,也无法在 VS Code 中调试 TypeScript 文件。我已在 Chrome 属性 中将 target 设置为 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--remote-debugging-port=9222"。我得到的错误是[debugger-for-chrome] Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9222。杀死所有chrome.exe 进程后,请参阅下图以了解错误。有人可以帮我解决这个问题吗?提前致谢。
.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>
【问题讨论】:
-
尝试在任务管理器中杀死所有
chrome.exe进程,然后尝试使用远程调试标志再次启动 -
您可以将这些文本文件作为文本发布吗?如果有人想重现您的情况,他们必须重新输入所有代码。
-
@Gideon 我试过杀死所有 chrome.exe 进程。现在我收到了
"Failed to load resource: net::ERR_CONNECTION_REFUSED (http://localhost:3000/)"错误,您可以在我刚刚编辑的这篇文章中引用它 -
@MikeMcCaughan 我已经编辑了这篇文章。有意义吗?
-
好多了,但请务必包含错误消息的文本。问题是图像不可搜索,因此试图通过搜索找到此图像的人会很不走运。
标签: typescript visual-studio-code nativescript vscode-debugger