pm2 starts two duplicate processes with a different version
Asked Answered
C

2

7

I am using pm2 version 4.2.3

When I run this command: pm2 start node launchers/engine_launcher.js --name "engine", it starts the following:

id  │ name                           │ namespace   │ version │ mode    │ pid
------------------------------------------------------------------------------
12  │ engine                         │ default     │ 0.34.0  │ fork    │ 893
13  │ engine                         │ default     │ 1.0.0   │ fork    │ 8946

I want only one process to be started. If I pm2 delete engine, both go away.

launchers/engine_launcher.js is a regular javascript script.

What causes this problem? How can I start only one version of my script?

This doesn't happen for other scripts, only this one.

Cariole answered 22/3, 2020 at 14:25 Comment(0)
W
9

Instead of start node app.js use just start app.js.

Wapiti answered 18/5, 2020 at 22:14 Comment(3)
This works for me. Can you explain what really happens when we use start?Affenpinscher
Will this still work if app.js doesn't have a shebang line?Florrie
I think it means pm2 start app.js starts app.js inside node directly instead of running a second node process, think it works without a shebang lineWapiti
C
3

pm2 delete 12 is one way to do it.

Cariole answered 22/3, 2020 at 14:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.