![](/img/trans.png)
[英]Prevent nodejs from minifying javascript code while developing / debugging
[英]Cannot start debugger in Visual Code while developing in NodeJS
我正在嘗試通過Visual Code調試器運行MEAN應用程序,但無法啟動它。 它向我顯示一個Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:58...
錯誤。我正在運行節點8.1.0和npm 5.0.3。這是我的啟動配置文件
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"windows": {
"runtimeExecutable": "npm.cmd"
},
"runtimeArgs": [
"run",
"startdev"
],
"port": 5858,
"protocol": "inspector"
}
]
}
每當我執行程序時,我都會使用npm run startdev
來運行它, startdev
是package.json
的腳本。 如何啟動調試器?
編輯:
我正在使用npm run startdev
運行應用npm run startdev
,其中startdev
是
"startdev": "concurrently \\"ng build --watch\\" \\"cross-env NODE_ENV=development nodemon ./bin/start.js\\""
我也嘗試了這樣的附加配置,但無濟於事
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"processId": "${command:PickProcess}",
"port": 5858
}
您應該使用attach配置將調試器附加到節點進程。
您還需要使用debug標志啟動該過程,例如
node --debug <filename>
另外,正如OP在注釋中指出的那樣,不建議使用debug標志。 因此,請使用檢查標志。
node --inspect <filename>
附加配置看起來像{ "name": "Attach", "type": "node", "request": "attach", "port": 5858, "address": "localhost", "restart": false, "sourceMaps": false, "outFiles": [], "localRoot": "${workspaceRoot}", "remoteRoot": null }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.