pm2-hive / pm2-syslog

PM2 module to redirect application logs to syslog
41 stars 28 forks source link

pm2 is listed as a dep but not in package.json? #1

Closed mderazon closed 8 years ago

mderazon commented 9 years ago

I am running node, npm and pm2 via nvm. I can't seem to get this plugin to work.

I get Error: Cannot find module 'pm2' :

pm2-syslog-7 (err):     at Object.<anonymous> (/home/ubuntu/.pm2/node_modules/pm2-syslog/app.js:5:15)
pm2-syslog-7 (err):     at Module._compile (module.js:410:26)
pm2-syslog-7 (err):     at Object.Module._extensions..js (module.js:428:10)
pm2-syslog-7 (err):     at Module.load (module.js:335:32)
pm2-syslog-7 (err):     at Function.Module._load (module.js:290:12)
pm2-syslog-7 (err):     at Function.Module.runMain (module.js:451:10)
pm2-syslog-7 (err): module.js:318
pm2-syslog-7 (err):     throw err;
pm2-syslog-7 (err):           ^
pm2-syslog-7 (err): Error: Cannot find module 'pm2'
pm2-syslog-7 (err):     at Function.Module._resolveFilename (module.js:316:15)
pm2-syslog-7 (err):     at Function.Module._load (module.js:258:25)
pm2-syslog-7 (err):     at Module.require (module.js:345:17)
pm2-syslog-7 (err):     at require (module.js:364:17)
pm2-syslog-7 (err):     at Object.<anonymous> (/home/ubuntu/.pm2/node_modules/pm2-syslog/app.js:5:15)
pm2-syslog-7 (err):     at Module._compile (module.js:410:26)
pm2-syslog-7 (err):     at Object.Module._extensions..js (module.js:428:10)
pm2-syslog-7 (err):     at Module.load (module.js:335:32)
pm2-syslog-7 (err):     at Function.Module._load (module.js:290:12)
pm2-syslog-7 (err):     at Function.Module.runMain (module.js:451:10)
jshkurti commented 9 years ago

Try installing pm2 locally npm i pm2.

Unitech commented 9 years ago

Hi, I forgot to include pm2 as a dependency

You can git clone this repo, add pm2 as a dependency and start the app.js. Feel free to add some line to this file to redirect whatever you need to syslogs, it's straightforward

https://github.com/Unitech/PM2/blob/master/doc/PROGRAMMATIC.md#bus-system---event-monitoring

mderazon commented 9 years ago

thank you.

I have tried forking it and updating the script package.json to include pm2, but I am running into some trouble when trying to install my fork with pm2. Not sure where the module registry is taken from (?) but I have tried

pm2 install mderazon/pm2-syslog

(github_user/repo)

I see that it gets downloaded okay but the installation fails:

> unix-dgram@0.1.1 install /home/ubuntu/.pm2/node_modules/pm2-syslog/node_modules/ain2/node_modules/unix-dgram
> node-gyp rebuild

..gyp ERR! build error
gyp .ERR! stack Error: not found: make
gyp ERR! stack     at F (/home/ubuntu/.nvm/versions/io.js/v1.6.4/lib/node_modules/npm/node_modules/which/which.js:40:28)
gyp ERR! stack     at E (/home/ubuntu/.nvm/versions/io.js/v1.6.4/lib/node_modules/npm/node_modules/which/which.js:43:29)
gyp ERR! stack     at /home/ubuntu/.nvm/versions/io.js/v1.6.4/lib/node_modules/npm/node_modules/which/which.js:54:16
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:77:15)
gyp ERR! System Linux 3.13.0-49-generic
gyp ERR! command "/home/ubuntu/.nvm/versions/io.js/v1.6.4/bin/iojs" "/home/ubuntu/.nvm/versions/io.js/v1.6.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/.pm2/node_modules/pm2-syslog/node_modules/ain2/node_modules/unix-dgram
gyp ERR! node -v v1.6.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing unix-dgram@0.1.1
npm WARN optional dep failed, continuing fsevents@0.3.5
..pm2-syslog@1.3.0 .pm2/node_modules/pm2-syslog
├── pmx@0.3.5 (debug@2.1.3)
├── ain2@1.5.2
└── pm2@0.12.10 (ikt@0.0.0, json-stringify-safe@5.0.0, cli-table@0.3.1, eventemitter2@0.4.14, commander@2.6.0, pidusage@0.1.1, cron@1.0.5, debug@2.1.0, async@0.9.0, chalk@0.5.1, vizion@0.2.5, isbinaryfile@2.0.3, pm2-multimeter@0.1.2, pm2-deploy@0.1.2, colors@1.0.3, pm2-axon-rpc@0.3.6, semver@4.3.1, shelljs@0.3.0, pm2-axon@2.0.8, nssocket@0.5.3, chokidar@0.12.6, coffee-script@1.8.0, pm2-logs@0.1.1, moment@2.9.0)
[PM2][Module] Module downloaded
module.js:318
    throw err;
    ^
Error: Cannot find module '/home/ubuntu/.pm2/node_modules/mderazon/pm2-syslog/package.json'
    at Function.Module._resolveFilename (module.js:316:15)
    at Function.Module._load (module.js:258:25)
    at Module.require (module.js:345:17)
    at require (module.js:364:17)
    at startModule (/home/ubuntu/.nvm/versions/io.js/v1.6.4/lib/node_modules/pm2/lib/Modularizer.js:37:22)
    at /home/ubuntu/.nvm/versions/io.js/v1.6.4/lib/node_modules/pm2/lib/Modularizer.js:190:7
    at /home/ubuntu/.nvm/versions/io.js/v1.6.4/lib/node_modules/pm2/node_modules/shelljs/src/exec.js:107:7
    at ChildProcess.exithandler (child_process.js:707:7)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:169:7)

Is it related to iojs ?

mderazon commented 9 years ago

I think there are two problems actually. first one is the build gyp error with the ain2 module (phuesler/ain#30) this fails on your version of the module with iojs as well.

second problem probably related to a bad install or something related to pm2?

Unitech commented 9 years ago

Damn me may look for another nodejs syslog module. I just forgot to add pm2 here