How do you use pm2 startup with a non-root user?

(Posted on behalf of the OP).

In fact that was the problem. Fixed via creating a symlink (as root):

ln -s /usr/bin/nodejs /usr/sbin/node

I don't know if it will help you but I use in this way:


  1. As a non-root user
pm2 startup -u <YOUR_NON_ROOT_USER>
  1. Copy line showed like
env PATH=$PATH:/usr/bin pm2 startup systemd -u delivery --hp /home/delivery
  1. As a root execute
env PATH=$PATH:/usr/bin pm2 startup systemd -u delivery --hp /home/delivery
  1. Back to non root user and type:
pm2 start <YOUR /PATH/TO/INDEX.JS> --name <YOU_APPLICATION_NAME>
  1. As a non-root type:
pm2 save
  1. reboot
sudo reboot
  1. As a non-root user type the commando bellow to check if it works
pm2 status

PS: Change as needed.

I hope it will be useful for you or someone.