greatcare / pm2-zabbix

A Node.js PM2 monitoring tool for Zabbix.
MIT License
87 stars 60 forks source link

Warnings like (node:6980) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency #50

Open elcreator opened 3 years ago

elcreator commented 3 years ago

~# node -v v14.15.4

I have Zabbix 5.0.4. Can't use pm2-zabbix due to the next problem:

~# pm2-zabbix --discover

(node:6980) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6980) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:6980) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
...

[KM] Connecting
internal/fs/utils.js:779
  throw new ERR_INVALID_ARG_TYPE(
  ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (6999)
    at Object.writeFileSync (fs.js:1460:5)
    at daemonize (/usr/local/lib/node_modules/pm2-zabbix/node_modules/pm2/lib/Interactor/InteractorDaemonizer.js:237:6)
    at /usr/local/lib/node_modules/pm2-zabbix/node_modules/pm2/lib/Interactor/InteractorDaemonizer.js:186:7
    at ReqSocket.<anonymous> (/usr/local/lib/node_modules/pm2-zabbix/node_modules/pm2/lib/Interactor/InteractorDaemonizer.js:41:12)
    at Object.onceWrapper (events.js:421:28)
    at ReqSocket.emit (events.js:315:20)
    at Timeout._onTimeout (/usr/local/lib/node_modules/pm2-zabbix/node_modules/pm2-axon/lib/sockets/sock.js:278:12)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7) {
  code: 'ERR_INVALID_ARG_TYPE'
}
elcreator commented 3 years ago
NODE_OPTIONS="--trace-warnings" pm2-zabbix --discover
(node:9350) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:650:11)
    at Object.get (internal/modules/cjs/loader.js:664:5)
    at Object._register [as register] (/root/.nvm/versions/node/v14.15.4/lib/node_modules/pm2-zabbix/node_modules/shelljs/src/common.js:455:12)
    at Object.<anonymous> (/root/.nvm/versions/node/v14.15.4/lib/node_modules/pm2-zabbix/node_modules/shelljs/src/cat.js:4:8)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
cuttep commented 3 years ago

pm2-zabbix/node_modules/shelljs/src/common.js
455 line // if (shell[name] && !wrapOptions.overWrite) { // throw new Error('unable to overwrite ' + name + ' command'); // }

elcreator commented 3 years ago

I have single file .nvm/versions/node/v14.15.4/bin/pm2-zabbix without node_modules in the same directory