我是为了创建一个小Discord机器人,我正在使用PM2观看并重新启动机器人。所以昨天我设置了一个进程文件,以便使用clustermode打开更多的istances。直到昨天,所有工作都很好,没有后顾之忧。今天,当我启动流程文件时,它会打开一个终端窗口,显示我拥有的每个权限,每次我保存文件,PM2将重新启动机器人,它会给出错误:
[DEP0007] DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
对于每个betance。我在线搜索,但任何线程都无法帮助我,我也重新安装了最新版本的pm2:
pm2 update
要么
npm install -g pm2@latest --save
我还使用命令行而不是进程文件:
pm2 start index.js -i 4 --name myapp --watch
但没有,当我继续pm2日志,在重启时它会给出错误。我怎么解决这个问题?
我的进程文件:
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'
}
}],
};
据https://github.com/Unitech/pm2/issues/3597说:
如果您使用的是Node版本<= 8,则可以忽略该警告(它是警告,而不是错误)或升级到节点版本> = 9.(提醒:节点LTS当前是版本10)。