0

when I type $ pm2 start --name chat-1 chat.index.js -- --name chat-1 --port 8080 groovy it works, then when I do: $ pm2 start --name chat-2 chat.index.js -- --name chat-2 --port 8081 it still goes to port 8080. I have attempted to replicate solving the issue as here however, cannot due to the poster not explaining how that solved the issue. I am using Express, Socket.io

in my app.js I have the variable set as: const PORT = process.env.PORT || 8080;

Ctfrancia
  • 1,248
  • 1
  • 15
  • 39
  • 1
    you're passing the port as argument, not as environment variable. – tkausl Mar 19 '19 at 19:10
  • I've been searching for a clearer example but all that I have been seeing is using a .env file (which I am already). when I use the `$ pm2 start --name chat-2 chat.index.js -- --name chat-2 --port 8081` is the .env file overwriting what I pass in through pm2? – Ctfrancia Mar 19 '19 at 20:44
  • Did you try :` $ PORT=8081 pm2 start --name chat-2 chat.index.js` – Jem Ha Apr 03 '19 at 03:36
  • @JemHa I have not tried that yet, I will give that a try later and let you know how it goes, thanks for commenting! – Ctfrancia Apr 03 '19 at 07:33

0 Answers0