启动 app
pm2 start --node-args="--inspect=9229" app.js
--inspect=9229 设置调试端口为 9229
vscode里添加 launch.json
环境选择选 Node.js 即可
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}",
"name": "Attach to Remote",
"port": 9229,
"remoteRoot": "/home/git/test-sequelize/",
"request": "attach",
"restart": true,
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
}
点击启动 debug
出现下面浮框启动成功
打开:http://localhost:3000/
打开调试控制台
点开 右侧 app.js 文件可以打断点进行调试