What I used to do with Perl or shell scripting, I do with Node.js. Here’s how to pass node arguments to a pm2 start command.
I have Node.js application that uses garbage collection. For it to work, I have to pass the –expode-gc node command-line argument. Since I use pm2 to manage my Node.js applications, I needed to send that argument to pm2.
Here’s how to do that.
pm2 start mynodeapp --node-args="--expose-gc"