pm2-logrotate is not running, showing errored status all the time
anvesh14 opened this issue · 5 comments
What's going wrong?
I am trying to install pm2-logrotate@2.7.0 on pm2@3.5.2 (node.js@3.5.2), i am unable to run the pm2-logrotate and facing issues.
pm2 log info
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:511:25)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at Module.Hook._require.Module.require (/app/node/.nvm/versions/node/v6.1.0/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
at require (internal/module.js:20:19)
at Object. (/app/node/.pm2/modules/pm2-logrotate/node_modules/pm2/lib/API.js:15:21)
/app/node/.pm2/modules/pm2-logrotate/node_modules/chalk/source/index.js:103
...styles,
^^^
PM2 log: App [pm2-logrotate:0] online
PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 log: App [pm2-logrotate:0] online
PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 log: App [pm2-logrotate:0] online
PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 log: App [pm2-logrotate:0] online
PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 log: App [pm2-logrotate:0] online
PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 log: Script /app/node/.pm2/modules/pm2-logrotate/node_modules/pm2-logrotate/app.js had too many unstable restarts (16). Stopped. "errored"
==================================================================
How could we reproduce this issue?
- Install the node.js@6.1.0 (npm@3.86)
- Upgrade the pm2 from pm2@1.1.3 to pm2@3.5.2
- Install the pm2-logrotate@2.7.0
- pm2 list (here i could see that pm2-logrotate is errored)
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Tue May 26 2020 09:14:07 GMT-0400 (EDT)
--- Daemon -------------------------------------------------
pm2d version : 3.5.2
node version : 6.1.0
node path : /app/node/.nvm/versions/node/v6.1.0/bin/pm2
argv : /app/node/.nvm/versions/node/v6.1.0/bin/node,/app/node/.nvm/versions/node/v6.1.0/lib/node_modules/pm2/lib/Daemon.js
argv0 : undefined
user : node
uid : 867
gid : 865
uptime : 47min
--- CLI ----------------------------------------------------
local pm2 : 3.5.2
node version : 6.1.0
node path : /app/node/.nvm/versions/node/v6.1.0/bin/pm2
argv : /app/node/.nvm/versions/node/v6.1.0/bin/node,/app/node/.nvm/versions/node/v6.1.0/bin/pm2,report
argv0 : undefined
user : node
uid : 867
gid : 865
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz
cpus nb : 2
freemem : 481648640
totalmem : 3731562496
home : /app/node
--- PM2 list -----------------------------------------------
┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
Module
┌───────────────┬────┬─────────┬─────┬─────────┬─────────┬─────┬────────┬──────┐
│ Module │ id │ version │ pid │ status │ restart │ cpu │ memory │ user │
├───────────────┼────┼─────────┼─────┼─────────┼─────────┼─────┼────────┼──────┤
│ pm2-logrotate │ 0 │ 2.7.0 │ 0 │ errored │ 15 │ 0% │ 0 B │ node │
└───────────────┴────┴─────────┴─────┴─────────┴─────────┴─────┴────────┴──────┘
--- Daemon logs --------------------------------------------
/app/node/.pm2/pm2.log last 20 lines:
PM2 | 2020-05-26T08:41:39: PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] online
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] online
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] online
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] online
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] online
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] starting in -fork mode-
PM2 | 2020-05-26T08:41:40: PM2 log: App [pm2-logrotate:0] online
PM2 | 2020-05-26T08:41:41: PM2 log: App [pm2-logrotate:0] exited with code [1] via signal [SIGINT]
PM2 | 2020-05-26T08:41:41: PM2 log: Script /app/node/.pm2/modules/pm2-logrotate/node_modules/pm2-logrotate/app.js had too many unstable restarts (16). Stopped. "errored"
same problem's here.
chalk
use Spread_in_object_literals from v3.0.0, it needs node>=8.
since pm2-logroate has pm2@latest
as a dependency, it uses chalk>3.0.0.
Line 10 in 1e6904a
I'll be glad if there's a branch for legacy versions of node.
@anvesh14 as a workaround, I forked pm2-logrotate and made pm2-logrotate-legacy-nodejs.
It's not tested perfectly, but it seems work for now.
@rapidia , Thanks for the suggestion. I followed different approach which resolved my issue
Actually i cloned the code of pm2-logrotate and updated the pm2-logrotate/package.json file with below
"pm2": "latest",
with "pm2": "<pm2 version that running>",
in my case it is "pm2": "3.5.2",