我目前正在开发一个完全使用 Node.js 的应用程序,因此有 2 个 nodemon 实例同时运行,client
并且server
:
.
|-- README.md
|-- client
| |-- index.js
| |-- node_modules
| |-- package-lock.json
| `-- package.json
`-- server
|-- index.js
|-- node_modules
|-- package-lock.json
`-- package.json
4 directories, 7 files
所以这是 VS Code 中打开的目录。在scripts
两者的部分中,package.json
我有以下内容:
"dev": "nodemon --inspect ./index.js"
我对如何调试 nodemon 实例进行了一些研究,并在 VS Code 的存储库中找到了此配置:
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Node: Nodemon",
"processId": "${command:PickProcess}",
"restart": true,
"protocol": "inspector",
}
]
但现在的问题是,当我同时运行这两个脚本时,我的终端出现以下错误:Starting inspector on 127.0.0.1:9229 failed: address already in use
是否可以在另一个端口上使用调试器?