question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't exec with shell node v4

See original GitHub issue
TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (internal/child_process.js:285:26)
    at ChildProcess.spawn (/usr/share/pm2/node_modules/pmx/node_modules/vxx/node_modules/continuation-local-storage/node_modules/async-listener/index.js:120:29)
    at exports.spawn (child_process.js:362:9)
    at Object.exports.execFile (child_process.js:151:15)
    at Object.exports.exec (child_process.js:111:18)
    at refreshMetrics (/home/florian/.pm2/node_modules/pm2-server-monit/lib/drive.js:10:6)
    at Object.init (/home/florian/.pm2/node_modules/pm2-server-monit/lib/drive.js:100:3)
    at /home/florian/.pm2/node_modules/pm2-server-monit/app.js:46:9
    at Object.PMX.initModule (/home/florian/.pm2/node_modules/pmx/lib/pmx.js:116:12)
$ node -v
v4.6.2

But work correctly if {shell: true} is not specified. @vmarchaud @Unitech

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
vmarchaudcommented, Apr 25, 2017

@altras Nothing else i think, we will investigate thanks πŸ˜ƒ

0reactions
aivuscommented, Dec 6, 2017

I’m still getting this error on node v4.7.0

Module activated
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Module           β”‚ version β”‚ target PID β”‚ status  β”‚ restart β”‚ cpu β”‚ memory β”‚ user   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ pm2-server-monit β”‚ 2.5.2   β”‚ N/A        β”‚ errored β”‚ 15      β”‚ 0%  β”‚ 0 B    β”‚ ------ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

pm2 version: 2.8.0

logs:

~ $ pm2 logs pm2-server-monit
[TAILING] Tailing last 15 lines for [pm2-server-monit] process (change the value with --lines option)
/home/-----/.pm2/logs/pm2-server-monit-out-5.log last 15 lines:
/home/-----/.pm2/logs/pm2-server-monit-error-5.log last 15 lines:
5|pm2-serv |     at refreshMetrics (/home/-----/.pm2/node_modules/pm2-server-monit/lib/drive.js:10:3)
5|pm2-serv |     at Object.init (/home/-----/.pm2/node_modules/pm2-server-monit/lib/drive.js:100:3)
5|pm2-serv |     at /home/-----/.pm2/node_modules/pm2-server-monit/app.js:46:9
5|pm2-serv |     at Object.PMX.initModule (/home/-----/.pm2/node_modules/pm2-server-monit/node_modules/pmx/lib/pmx.js:124:12)
5|pm2-serv | TypeError: Bad argument
5|pm2-serv |     at TypeError (native)
5|pm2-serv |     at ChildProcess.spawn (internal/child_process.js:285:26)
5|pm2-serv |     at exports.spawn (child_process.js:362:9)
5|pm2-serv |     at Object.exports.execFile (child_process.js:151:15)
5|pm2-serv |     at Object.exports.exec (child_process.js:111:18)
5|pm2-serv |     at module.exports (/home/-----/.pm2/node_modules/pm2-server-monit/lib/exec.js:15:6)
5|pm2-serv |     at refreshMetrics (/home/-----/.pm2/node_modules/pm2-server-monit/lib/drive.js:10:3)
5|pm2-serv |     at Object.init (/home/-----/.pm2/node_modules/pm2-server-monit/lib/drive.js:100:3)
5|pm2-serv |     at /home/-----/.pm2/node_modules/pm2-server-monit/app.js:46:9
5|pm2-serv |     at Object.PMX.initModule (/home/-----/.pm2/node_modules/pm2-server-monit/node_modules/pmx/lib/pmx.js:124:12)

Read more comments on GitHub >

github_iconTop Results From Across the Web

nodeJS exec does not work for "cd " shell cmd - Stack Overflow
Your shell IS executing cd but it's just that each shell throws away it's working directory after it's finished. Hence you're back at...
Read more >
Executing Shell Commands with Node.js - Stack Abuse
In this article, we will learn the various ways to execute shell commands in Node.js using the child_process module.
Read more >
nodejs not working, exec format error #8151 - GitHub
nodejs can start if we manually invoke ld-linux, although it is already the interpreter in the ELF. wangqr@ocalhost:~$ /usr/bin/node zsh: exec ...
Read more >
How to run `shell` and more using Node.js - NodeSource
The exec() method from the child_process module will spawn a shell in your machine, and that's how you run shell commands using node:...
Read more >
How to Execute Shell Commands With Node.Js
This tutorial will teach you how to execute shell commands, ... return if we encounter an error console.error("could not execute command: "Β ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found