I have a node express app used as GUI for an embedded raspberry pi controller that manipulates a device via the gpio interface. The app runs fine with the command "sudo node app.js", but fails if I try to run it with the command "node app.js" with the error...
2022-08-28 21:48:03 initCheckPermitted:
+---------------------------------------------------------+
|Sorry, you don't have permission to run this program. |
|Try running as root, e.g. precede the command with sudo. |
+---------------------------------------------------------+
/home/ko2f/resonate/node_modules/pigpio/pigpio.js:17
pigpio.gpioInitialise();
I would like to use pm2 to automatically run my app each time the controller restarts.
Is there a way to start a node application with pm2 running as root?
resonate is the actual name of my app.
from my node application folder, I entered the command:
sudo pm2 start resonate.js
and got a [pm2] Process successfully started response. I entered the command:
sudo pm2 status
and pm2 returned a status of 'errored'. What did I miss?