我正嘗試使用Visual Studio代碼& gulp設置基於打印腳本的快速應用程序工作流程。vscode無法啓動節點應用程序
繼承人我的項目結構:
src/ <-- souce files
Start.ts
Server.ts
models/
Contact.ts
Organization.ts
bin/ <-- compiled output
Start.js
Start.js.map
...
tsconfig.json
gulpfile.json
package.json
.vscode/
launch.json
執行下面的命令序列,我可以編譯&啓動我的應用程序中集成終端:
> tsc
> node --debug-brk ./bin/Start.js
在這一點上,我可以成功連接到我的應用程序使用默認的「attach to process」命令(並且它甚至在打字稿文件中正確輸入斷點,yeyy!):
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"address": "localhost",
"port": 5858
}
但是,與F5
一起啓動失敗每次。目前在調試控制檯沒有輸出,並在幾秒鐘內我會在頂部的錯誤橫幅,上面寫着Cannot connect to runtime via 'legacy' protocol; consider using 'inspector' protocol (timeout after 10000 ms).
這裏是我的啓動配置(在launch.json):
{
"type": "node",
"request": "launch",
"name": "Launch Program",
// Using compiled .js file. vscode should use the sourcemap to correlate
// with breakpoints in the source file
"program": "${workspaceRoot}/bin/Start.js",
"outFiles": [ "${workspaceRoot}/bin/**/*.js" ]
}
我試着開調試控制檯。每次我保存launch.json文件,它給了我下面的錯誤:Cannot read property '_runner' of undefined: TypeError: Cannot read property '_runner' of undefined
在shell.ts:426
谷歌搜索的錯誤,我碰到this bug
來到那這個錯誤是什麼意思?有沒有解決方法?什麼哦,我該怎麼辦?
'node2'的意義是什麼? – Julien
沒有什麼特別的:https://marketplace.visualstudio.com/items?itemName=ms-vscode.node-debug2它曾經幫助我處理'奇怪'的情況,但是如果你有最新的VSCode,那麼node2已經被棄用了並自動切換到:https://code.visualstudio.com/updates/v1_10#_node2-transitioning – Amid