centos 下使用vscode 调试egg.js 注意事项

这两天在centos下,直接用vscode运行egg.js的例子。遇到个问题就是当安装了vscode-egg插件,会遇到一个现象。就是一样的代码,Windows下调试能够顺利进行,可是centos有时候好,有时候不行,由于也是刚刚在作这一块工做,知其然,不知其因此然。javascript

在egg.js下发了帖子。明白了道理java

https://github.com/eggjs/egg/issues/3283node

根本缘由就是参数配置区别;git

其中,--inspect-brk 是指在进程第一行就暂停,等待 attach,所以:github

  • master 先启动,在第一行会停住,须要你 attach master,才会往下走
  • 接着 master 启动 agent,也是在第一行停住,须要 attach agent 才会往下走
  • 最后 agent 启动完成后,worker 才开始启动,同样也是在第一行停住,须要 attach agent 才会往下走

配置我这里发一下npm

1.会出现停住的配置:centos

{
            "type": "node",
            "request": "launch",
            "name": "Egg Debug",
            "runtimeExecutable": "npm",
            "runtimeArgs": [
                "run",
                "debug",
                "--",
                "--inspect-brk"
            ],
            "console": "integratedTerminal",
            "restart": true,
            "protocol": "auto",
            "port": 9229,
            "autoAttachChildProcesses": true
        },

 

2.修改后的配置spa

{
            "type": "node",
            "request": "launch",
            "name": "Egg Debug",
            "runtimeExecutable": "npm",
            "runtimeArgs": [
                "run",
                "debug",
                "--",
                "--inspect"
            ],
            "console": "integratedTerminal",
            "restart": true,
            "protocol": "auto",
            "port": 9229,
            "autoAttachChildProcesses": true
        },
相关文章
相关标签/搜索