Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.12k stars 2.6k forks source link

PM2 keep spamming terminals on start #5647

Open NivGreenstein opened 1 year ago

NivGreenstein commented 1 year ago

I have created pm2 Ecosystem File that looks like this:

const os = require('os');
const fs = require('fs');
const path = require('path');

const services = [ 
        {name: 'gatewayService', port: 3000}, 
        {name: 'microserviceA', port: 3001},
        {name: 'microserviceB', port: 3002}
];

const backend = services.map(service => ({
                script: 'src/index.ts',
                node_args: ' -r ts-node/register',
                interpreter: 'node'm
                max_restarts: 10,
                detached: true,
                name: service.name,
                watch: ['src'],
                cwd: `../${service.name}`,
                env :{
                        port: service.port, 
                        ...otherEnvs
                }
        }));

module.exports = {
  apps: backend
};

In the CMD I run pm2 run ./ecosystemFile.js.

For some reason that I can't figure out way, it keeps spamming on start with terminals (i figured out it's the node process). I don't know why but even the max_restart policy is being ignored.

Searched for few days but nothing seems to work.

Specs: Windows 11, node 16.16.0, pm2-latest - running on fork mode.

Thanks.

punowo commented 1 year ago

Might be a duplicate of https://github.com/Unitech/pm2/issues/2182 Ping me if you find a resolution. I haven't been able to.

JhordanEdyvald commented 3 weeks ago

I'm having the same problem, please if you fix it let me know. I've been trying to search on Google by keyword and nothing. It's as if no one exists with this problem.

punowo commented 3 weeks ago

@JhordanEdyvald Have you tried https://github.com/Unitech/pm2/issues/2182#issuecomment-2057721125 ?