Node-red not running with pm2

#1

Hi,

I just bought a new pi3+ and installed node-red into it . When I run it with command "node-red", nodered starts with not issue.

I have installed pm2 for which I have already 2 applications running this way but it doesn't work with node-red.

"which node-red" returns /usr/bin/node-red

When I run "pm2 start /usr/bin/node-red -- -v" version 3.0.3 is displayed but nothing starts and no errors are displayed.

I have tried several variations of it without success.

My config is the following:

10 Aug 17:09:13 - [info] Node-RED version: v0.18.7

10 Aug 17:09:13 - [info] Node.js version: v9.11.2

10 Aug 17:09:13 - [info] Linux 4.9.80-v7+ arm LE

Do you have any ideas of what I should do? I am don't know if it's an issue with node-red or pm2 because I can run node-red without pm2 but in the meantime, I have other processes running with pm2....

Thanks in advance..

#2

How did you install node-red?
Whilst not causing your issue you are running a version of node which might cause you issues going forward. The recommended version is V8.xLTS

Theres a script on the Node-RED raspberry pi page on the website that includes a script that should get you to the recommended versions.
https://nodered.org/docs/hardware/raspberrypi

There also a page that includes pm2 instructions but I think it's just doing what you have done. https://nodered.org/docs/getting-started/running

#3

Hi,
I have followed those instructions indeed. My version of node is 9 while on my old pi where everything worked just fine, it was 8. I can try to downgrade the version but this is strange that node-red can be started without pm2 and in the meantime I can start other nodejs app with pm2 without any issues. Seems to be something wrong with pm2 and node-red together.

Regards

#4

Try reporting the issue in pm2's GitHub, they are usually quick to respond.

#5

I found this issue, remove -v from node-red's arguments and it'll work. Seems like there's a conflict with the -v flag which for some reason seems passed to pm2 instead of Node-RED.

1 Like
#6

Yes indeed remiving -v has fixed the issue. Someone gave me also this instruction in github on the pm2 support.
Like I said I had no issue in the past but something has changed.
Thanks for your help