Search code examples
javascriptnode.jspm2

pm2 deprecated worker on cluster mode


I was going in order to create a Small Discord Bot, and i'm using PM2 to watch and restart the bot. SO yesterday i setted a process file in order to use the clustermode to open more istances. Until yesterday all works good with no worries. Today when i launch the process file, it opens a terminal window for each istance that i have, and each time i save a file and PM2 will restart the bot, it gives the error:

[DEP0007] DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.

For each istance. I searched online but any thread could not helped me, i also reinstalled the latest version of pm2:

pm2 update

or

npm install -g pm2@latest --save

i also uses the command line insted of the process file:

pm2 start index.js -i 4 --name myapp --watch 

but nothing, when i goes on pm2 logs, on restart it gives that error. How can i solve this?

My Process file:

module.exports = {
 apps : [{
  name: 'Economy',
  script: 'index.js',
  instances: 4,
  exec_mode: "cluster",
  autorestart: true,
  watch: true,
  ignore_watch: ["database"],
  max_memory_restart: '1G',
  env: {
    NODE_ENV: 'development'
  },
  env_production: {
    NODE_ENV: 'production'
  }
 }],
};

Solution

  • According to https://github.com/Unitech/pm2/issues/3597:

    If you're using Node version <= 8, you can ignore the warning (it's a warning, not an error) OR upgrade to Node version >= 9. (Reminder: Node LTS is currently version 10).