【发布时间】:2019-03-15 19:21:18
【问题描述】:
您好,我正在尝试在 VSCode 中设置断点并使用 Chrome 调试器。我的仓库有一个运行在http://localhost.lmig.com:3000/ 上的 Node JS 服务器。
我需要运行的主要 npm 命令是 npm start。
我的节点版本是 6.10.0。我的本地操作系统是 Mac OSX,我使用带有 NVM 的 zsh。到目前为止,我的 launch.json 是这样的:
configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost.lmig.com:3000/",
"webRoot": "${workspaceFolder}"
},{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"runtimeVersion": "6.10.0",
"runtimeArgs": [
"run-script",
"start",
"--debugger=3000"
],
"port": 3000,
"restart": true,
"protocol": "legacy",
"remoteRoot": "0.0.0.0:3000",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
// "outFiles": ["${workspaceRoot}/build/**/*.js"],
"sourceMaps": true
}
我的 package.json 是这样的:
它在集成终端中运行节点进程,但似乎仍然没有达到我的断点。
请帮忙
【问题讨论】:
-
--debugger=3000在与您托管程序的端口相同的端口上似乎不正确....但我不熟悉该选项
标签: node.js visual-studio-code visual-studio-debugging