Pm2: TypeError: Buffer.alloc is not a function

Created on 24 Jul 2018  路  7Comments  路  Source: Unitech/pm2

What's going wrong?

When starting my Docker container that is using pm2, I get this error:

pm2 launched in no-daemon mode (you can add DEBUG="*" env variable to get more messages)
[2018-07-24T20:34:53.113Z] PM2 log: Launching in no daemon mode
[2018-07-24T20:34:53.221Z] PM2 log: [PM2] Starting /src/server/server.js in cluster_mode (1 instance)
[2018-07-24T20:34:53.225Z] PM2 log: Starting execution sequence in -cluster mode- for app name:server id:0
[2018-07-24T20:34:53.286Z] PM2 log: App name:server id:0 online
[2018-07-24T20:34:53.289Z] PM2 log: [PM2] Done.
/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27
    buf = Buffer.alloc(SIZE)
                 ^

TypeError: Buffer.alloc is not a function
    at readUntilEnd (/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27:18)
    at /usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:68:5
    at FSReqWrap.oncomplete (fs.js:145:20)
pm2 launched in no-daemon mode (you can add DEBUG="*" env variable to get more messages)
[2018-07-24T20:35:01.420Z] PM2 log: Launching in no daemon mode
[2018-07-24T20:35:01.476Z] PM2 log: [PM2] Starting /src/server/server.js in cluster_mode (1 instance)
[2018-07-24T20:35:01.479Z] PM2 log: Starting execution sequence in -cluster mode- for app name:server id:0
[2018-07-24T20:35:01.539Z] PM2 log: App name:server id:0 online
[2018-07-24T20:35:01.541Z] PM2 log: [PM2] Done.
/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27
    buf = Buffer.alloc(SIZE)
                 ^

TypeError: Buffer.alloc is not a function
    at readUntilEnd (/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27:18)
    at /usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:68:5
    at FSReqWrap.oncomplete (fs.js:145:20)

How could we reproduce this issue?

Start a Docker container that uses pm2

Supporting information

I'm using the latest node version to date (10.7.0), same for pm2 (3.0.1)

Most helpful comment

Switched back to 2.10.4 for now, will try the newer version soon. Thanks! :)

All 7 comments

I am having the same issue. 馃槦

starting my application with pm2-runtime i have no issues with [email protected]

http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/

We published pm2 version 3.0.2 that pin the version of pidusage and should fix the issue, can everyone confirm that it's good now ?

Switched back to 2.10.4 for now, will try the newer version soon. Thanks! :)

Me too... :(

all good now, closing

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

cchan picture cchan  路  3Comments

alexpts picture alexpts  路  3Comments

lefam picture lefam  路  3Comments

shaunwarman picture shaunwarman  路  3Comments