在PM2群集模式下进行调试

时间:2020-09-23 17:25:03

标签: node.js pm2 vscode-debugger

我正在尝试使用vscode调试pm2集群模式下的应用程序。我可以在fork模式下执行此操作,但是现在我必须扩展我的应用程序才能尝试新功能。因此,我有以下设置:

VSCODE:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "Attach",
            "port": 9228,
            "restart": true
        }
    ]
}

PM2:

module.exports = {
    apps : [{
        name: 'app',
        script: 'src/index.js',
        instance_var: 'INSTANCE_ID',
        watch: true,
        ignore_watch: ['logs', '.git', 'test', 'openshift'],
        node_args : ['--inspect=9228'],
        exec_mode : 'cluster',
        instances: 2,
        env: {
            NODE_ENV: 'development'
        }
    }]
};

我得到了这个错误:

Error

有人可以帮助我吗?泰!

0 个答案:

没有答案