2

我無法打開本地主機,無法調試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

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.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> 
+0

嘗試殺害所有'chrome.exe'過程中你的任務管理器,然後嘗試你能後的文本文件作爲,你知道,文字與遠程調試標誌 –

+0

再次啓動?如果有人想重新創建你的情況,他們必須重新輸入所有的代碼。 –

+0

@Gideon我試圖殺死所有chrome.exe進程。現在我得到''無法加載資源:net :: ERR_CONNECTION_REFUSED(http:// localhost:3000 /)「錯誤,你可以參考這篇文章,我剛剛編輯 –

回答

2

不能直接回答這個問題,但也許仍然是有用的:你知道嗎,你可以在Chrome中直接調試打字稿,包括斷點?你甚至不需要安裝插件。 看到這個截圖:

enter image description here

+1

這很酷。但我怎麼能在代碼中調試'nativescript js'項目(對於android&ios)? –

+0

你可以檢查我的其他[後](http://stackoverflow.com/questions/38131709/tns-run-android-emulator-not-working-nativescript)有關nativescript模擬器問題,並給我一個解決方案? –

相關問題