- launch.json 文件配置如下
{
version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Remote",
"address": "127.0.0.1",
"port": 32312,
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/app.js"
}
]
}
"Attach to Remote" 添加设置nodejs 附加到远程计划

"Launch Program", 添加设置 nodejs 启动计划

- servers/config/servers.json 文件配置
{
"development":{
"connector": [
{"id": "connector-server-1",
"host": "127.0.0.1",
"port": 3150,
"clientHost": "127.0.0.1",
"clientPort": 3010,
"args": "--debug=32312",
"frontend": true}
]
},
"production":{
"connector": [
{"id": "connector-server-1",
"host": "127.0.0.1",
"port": 3150,
"clientHost": "127.0.0.1",
"clientPort": 3010,
"args": "--debug=32312",
"frontend": true}
]
}
}
注意 --debug=32312 端口号 32312 和 launch.json的端口号一致。
vscode添加pomelo helloworld项目gameserver

切换到调试窗口

第一步 启动 Launch Program 第二步 启动Attach to Remote
网友评论