PM2 doesn´t work with node-red
I have installed the Nodejs (from PLCnext Store) and node-red in AXC F 2152 (FW 2019.3). It is working well.
After I installed the PM2 to try to start Node-red automatically, but it is not working. I have used the follow commands:
npm install -g pm2
pm2 start node-red
pm2 save
pm2 startup
Everything seems to be Ok, but after PLC restart, the node-red doesn´t start.
I took a look in the log file and I saw that after the "pm2 start node-red" command, the pm2 shows the follow error (see complete log file attached):
"PM2 error: Error while getting PAGESIZE { Error: Command failed: getconf PAGESIZE
/bin/sh: getconf: command not found
PM2 error: Error while getting CLK_TCK { Error: Command failed: getconf CLK_TCK
/bin/sh: getconf: command not found"
Could this error be the cause of the problem of pm2 is not working ?
Sidnei Marcondes
After I installed the PM2 to try to start Node-red automatically, but it is not working. I have used the follow commands:
npm install -g pm2
pm2 start node-red
pm2 save
pm2 startup
Everything seems to be Ok, but after PLC restart, the node-red doesn´t start.
I took a look in the log file and I saw that after the "pm2 start node-red" command, the pm2 shows the follow error (see complete log file attached):
"PM2 error: Error while getting PAGESIZE { Error: Command failed: getconf PAGESIZE
/bin/sh: getconf: command not found
PM2 error: Error while getting CLK_TCK { Error: Command failed: getconf CLK_TCK
/bin/sh: getconf: command not found"
Could this error be the cause of the problem of pm2 is not working ?
Sidnei Marcondes
Comments
It looks likes the behaviour of PM2 may have changed since that blog post was written. It would take some more investigation of how exactly pm2 works, which I am afraid is beyond the scope of us here at Phoenix Contact Support - perhaps another Community member with an interest in Node has time to research this.
If you have no luck with your own investigation of pm2, you could try another one of the init.d options mentioned at the end of the page referenced in the post (https://nodered.org/docs/getting-started/running), or else you could raise an issue on the pm2 Github page (https://github.com/Unitech/pm2#process-management).
- Martin.
Following your suggestion, I have adapted the script from node-red page and I got to start the node-red by init.d. It is working well.
Link for the script
Thank you for your support
Sidnei
Thank you for the feedback.
Please feel free to describe this solution on the Makers Blog for as a reference for others.
- Martin.