pm2
pm2 copied to clipboard
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (2042)
What's going wrong?
After restarting the server again try to start pm2 service then hapened this.
(node:2024) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use node --trace-warnings ...
to show where the warning was created)
(node:2024) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:2024) Warning: Accessing non-existent property 'which' of module exports inside circular dependency
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (2042)
How could we reproduce this issue?
restart the server and try to start the pm2 server.
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Tue Sep 28 2021 04:32:51 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 4.2.3
node version : 14.15.5
node path : /usr/local/bin/pm2
argv : /usr/bin/node,/usr/local/share/.config/yarn/global/node_modules/pm2/lib/Daemon.js
argv0 : node
user : root
uid : 0
gid : 0
uptime : 28min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 4.2.3
node version : 14.15.5
node path : /usr/local/bin/pm2
argv : /usr/bin/node,/usr/local/bin/pm2,report
argv0 : node
user : root
uid : 0
gid : 0
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) Gold 5120 CPU @ 2.20GHz
cpus nb : 2
freemem : 347742208
totalmem : 1876996096
home : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼───────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ server │ default │ N/A │ fork │ 2145 │ 25m │ 0 │ online │ 0% │ 62.2mb │ root │ disabled │
└─────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:
PM2 | 2021-09-28T04:04:28: PM2 log: BUS socket file : /root/.pm2/pub.sock
PM2 | 2021-09-28T04:04:28: PM2 log: Application log path : /root/.pm2/logs
PM2 | 2021-09-28T04:04:28: PM2 log: Worker Interval : 30000
PM2 | 2021-09-28T04:04:28: PM2 log: Process dump file : /root/.pm2/dump.pm2
PM2 | 2021-09-28T04:04:28: PM2 log: Concurrent actions : 2
PM2 | 2021-09-28T04:04:28: PM2 log: SIGTERM timeout : 1600
PM2 | 2021-09-28T04:04:28: PM2 log: ===============================================================================
PM2 | 2021-09-28T04:07:04: PM2 log: App [server:0] starting in -fork mode-
PM2 | 2021-09-28T04:07:04: PM2 error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (2145)
PM2 | at Object.writeFileSync (fs.js:1460:5)
PM2 | at /usr/local/share/.config/yarn/global/node_modules/pm2/lib/God/ForkMode.js:264:12
PM2 | at wrapper (/usr/local/share/.config/yarn/global/node_modules/pm2/node_modules/async/internal/once.js:12:16)
PM2 | at next (/usr/local/share/.config/yarn/global/node_modules/pm2/node_modules/async/waterfall.js:96:20)
PM2 | at /usr/local/share/.config/yarn/global/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
PM2 | at WriteStream.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/pm2/lib/Utility.js:186:13)
PM2 | at WriteStream.emit (events.js:315:20)
PM2 | at WriteStream.EventEmitter.emit (domain.js:529:15)
PM2 | at internal/fs/streams.js:380:12
PM2 | at FSReqCallback.oncomplete (fs.js:171:23)
PM2 | 2021-09-28T04:07:04: PM2 log: App [server:0] online
I have the same issue. Have you been able to figure this out?
For me, what I see is...
After I reboot my pi, pm2 starts up the 1 thing I've added to it (node-red), but after a minute or so, node-red stops. And when I do pm2 status
and/or pm2 start node-red
, I see the same messages you see about "Accessing non-existent properties of module exports inside circular dependency". But actually, starting node-red back up works... until the next reboot. So every time I reboot, I have to start up node red (with pm2) manually, even though I always do a pm2 save
afterwards.
This all started after doing an npm and node update. Initially, I thought it was competing pm2 processes (installed at both root and user level), but I uninstalled the root one, and this still happens...
Did anyone resolve this issue? Am facing the same issue here.
It was fixed in e41282df4cd3a76c8950258a0ede2e6d79d81414 (4.4.0). Upgrade to latest.
Notice that if you have a previous version that installed its executable in /usr/local/bin
, delete all the pm2*
executables in it. npm 8 installs global packages in /usr/bin
.
the issue remains, I am using version 5.2.0
upgrading from 4.2.3 to 5.3.0 seems to fixed it for me
Upgrading from 4.2.3 to 4.5.6 seems to have worked for me (wasn't prepared to jump to 5.x yet)
I tried with docker keymetrics/pm2 image, I got the same error. Because of the version! But they still haven't updated the docker image with the latest version of pm2. 🥴
I tried with docker keymetrics/pm2 image, I got the same error. Because of the version! But they still haven't updated the docker image with the latest version of pm2. 🥴
I got the same error with keymetrics/pm2:latest-alpine. You can try the image of keymetrics/pm2:18-alpine, which is work for me.
I tried with docker keymetrics/pm2 image, I got the same error. Because of the version! But they still haven't updated the docker image with the latest version of pm2. 🥴
I got the same error with keymetrics/pm2:latest-alpine. You can try the image of keymetrics/pm2:18-alpine, which is work for me.
Hi John, Thank you for your info. Sure, I will try this way next time!