Read the statement by Michael Teeuw here.
Autostart woes
-
i have a 2.4.1 instance of MM running just fine… now to set to start on boot…
install pm2…
the doc for ‘pm2 startup’ doesn’t help me…
‘will give you the command u need to execute’execute when, how? if unattended, who is ‘you’?
anyhow…from the pi home directory
pm2 start mm.sh
doesn’t
now what?
i have a startup script, which checks for and starts other dependencies…
called run
it doesn’t work eitherand, so… IF I wanted pm2 to start at boot… how do I do THAT??
execute that ‘command’…done that too… and well, pm2 doesn’t start at boot… (no running process with pm2 in it anywhere)
now what?
-
I see this in the pi/.pm2/pm2.log, after service pm2-pi start
internal/modules/cjs/loader.js:583 throw err; ^ Error: Cannot find module './lib/eventemitter2'
and the systemctl status pm2-pi.service command produces
● pm2-pi.service - PM2 process manager Loaded: loaded (/etc/systemd/system/pm2-pi.service; enabled; vendor preset: enabled) Active: failed (Result: resources) since Tue 2018-07-10 10:36:25 CDT; 7s ago Docs: https://pm2.keymetrics.io/ Process: 2899 ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect (code=exited, status=0/SUCCESS) Jul 10 10:36:23 raspberrypi systemd[1]: Starting PM2 process manager... Jul 10 10:36:24 raspberrypi pm2[2899]: [PM2] Spawning PM2 daemon with pm2_home=/home/pi/.pm2 Jul 10 10:36:25 raspberrypi systemd[1]: pm2-pi.service: PID file /home/pi/.pm2/pm2.pid not readable (yet?) after start: No such file or directory Jul 10 10:36:25 raspberrypi systemd[1]: Failed to start PM2 process manager. Jul 10 10:36:25 raspberrypi systemd[1]: pm2-pi.service: Unit entered failed state. Jul 10 10:36:25 raspberrypi systemd[1]: pm2-pi.service: Failed with result 'resources'.
so, it looks like some pm2 install problem
-
I see this error/warning during
sudo npm pm2 install -g
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm”}) -
i gave up on pm2, edited /etc/rc.local
-
Did you try installing it without sudo? Just a guess
-
@mykle1 yes, cut and paste from the mm doc
-
I’d recommend trying to do it again using the description by MichMich
https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirrorIt is crystal clear from what I see, also describes what to do.
"the doc for ‘pm2 startup’ doesn’t help me…
‘will give you the command u need to execute’execute when, how? if unattended, who is ‘you’?"
No offense, but btoh the doc and your terminal will show you exactly what to do. Copy a line of text the terminal throws out and execute it again.
That’s the reason I’d suggest to do it again with a bit more patience. :-)