【发布时间】:2018-03-17 18:18:24
【问题描述】:
我确定这非常简单,但我似乎无法让调试器与 Launch via NPM vscode 模板一起使用。我有一个非常简单的 hello world,它带有一个 npm 脚本来运行应用程序。
如果我运行 Launch Program(仅使用节点的配置)一切正常,但是如果我使用 Launch via NPM 我得到
/Users/luke/.nvm/versions/node/v6.5.0/bin/npm --debug-brk=3837 run-script runit
hello-world@1.0.0 runit /Users/luke/source/playground/js/hello-world
节点索引.js
你好世界
并且没有命中断点。 (我也尝试过使用和不使用"protocol":"legacy")
我做错了什么,所有在线示例都表明这应该可以正常工作。
package.json
{
"name": "hello-world",
"version": "1.0.0",
"scripts": {
"runit": "node index.js"
}
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"protocol":"legacy",
"runtimeArgs": [
"run-script",
"runit"
]
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/index.js"
}
]
}
index.js
console.log('hello world');//with a breakpoint set here
【问题讨论】:
标签: node.js visual-studio-code