I am using pm2 to start my app but i am not able to pass argument to it. the command I am using is pm2 start app.js -- dev. Though this works with forever.
You need to start pm2 with something like: pm2 start app.js --name "app_name" -- arg1 arg2
Then in your code, you can get your args with: console.log(process.argv);
process.argv is a list like this: [ '/usr/local/bin/node', '/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js', 'arg1', 'arg2' ]