我無法打開本地主機,無法調試VS代碼中的TypeScript文件,因爲出現了一些錯誤。我已設置目標到"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--remote-debugging-port=9222"
在Chrome屬性。我得到了錯誤[debugger-for-chrome] Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9222
。殺死所有chrome.exe
進程後,請參考以下圖像以查找錯誤。有人可以幫我解決這個問題嗎?提前致謝。無法在TypeScript中進行調試 - VS Code
.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.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進程。現在我得到''無法加載資源:net :: ERR_CONNECTION_REFUSED(http:// localhost:3000 /)「錯誤,你可以參考這篇文章,我剛剛編輯 –