Read the statement by Michael Teeuw here.
PM2 MM2 Not starting on start up
-
@eugekiller Sure.
sudo npm uninstall -g pm2
When you installed PM2, did you copy & run the command it displayed for you?
-
Yes it did I will try to uninstall and install it back. Thanks B.
-
Well Just reinstalled PM2 and still nothing. Using this guide not sure if everything is correct on that. https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror
Is there a way to see if PM2 is even trying to load MM on start up. Or maybe something wrong with this command:
cd ~/MagicMirror
DISPLAY=:0 npm start -
Ok so i also tryed to do pm2 lists and there is nothing in the list. Does that mean anything?
-
Ok so i started doing some more digging. First i have a question PM2 does it actually load MM from a full reboot? meaning power off to RPI and a full start.
The reason i ask is because
When i open terminal in RPI and type npm start from MM directory it loads MM without any problems. Then i hit Ctrl Q it quits.
Then i do PM2 list and gives me 0 apps running.
Then I do pm2 start mm.sh again loads MM without a problem. Then i hit Ctrl Q it exits MM for about 10sec and then loads it back. During the 10sec I did pm2 list again and it said MM is running.So I dont think PM2 is actually loading MM from a full reboot.
-
BINGO Got it to work. Not sure if others had a problem with this or its something new. but here it is.
However, there is a bug on the generated startup script that prevents PM2 from automatically run at startup. You will need to edit /etc/init.d/pm2-init.sh and
replace: export PM2_HOME=“/root/.pm2”
with: export PM2_HOME=“/home/pi/.pm2”Got this from here: https://bekti.io/automatically-start-a-node-js-application-on-raspberry-pi/
-
Hey,I’m having this exact same issue. I’m trying to follow your steps but I can’t locate the pm2-init.sh file. I have the pm2 installed. I go follow the same directory paths as stated but that one file isn’t there. Any ideas about where the file is? It has to exist somewhere since I’m able to use it.
-
@sebzx10r Its directory is /etc/init.d/pm2-init.sh
-
@sebzx10r The way i did it also is used WinSCP to shh in to raspberry.
-