Reputation: 63
Sorry about the question unclarity.
Basically, I need to run my code with -r esm for it to work. With node, I simply do "node -r esm app.js" How could I do the same with PM2? I remember doing it earlier but eh.
I did something like "pm2 start node -r esm app.js" but now it says -r an unknown option. I tried doing "pm2 start app.js -- -r esm" but it didn't solve my problems, it did run the app, but not the esm module.
If someone could either help me with the pm2 command line or with loading the esm module some other way it would be appreciated.
Upvotes: 6
Views: 4259
Reputation: 5941
It seems you need to use node-args
option to specify pm2 that you want to load the esm module:
pm2 start app.js --node-args="-r esm"
This is the recommended syntax from the documentation of esm.
Upvotes: 10