I used to start a nodejs script with this command
node cli/myscript.js -c configs/some-config.json
I tried to start the same script using pm2. I found here a post handling the same theme.
I tried this :
pm2 start cli/myscript.js --node-args="-c configs/some-config.json"
I get a syntax error on the config file which I don't get when I don't use pm2.
SyntaxError: Unexpected token :
0|myscript | at checkScriptSyntax
I also tried this and get the same error:
pm2 start cli/myscript.js -- -c configs/some-config.json
It seems like that pm2 tries to execute the config as a js file.. because the config file is a valid json.