Read the statement by Michael Teeuw here.
Error: ENOENT: no such file or directory, open 'package.json'
-
An ENOENT error usually indicates that a command was issued in the wrong directory. This would occur if you were trying to run
npm start
in a directory other thanpi@raspberry:~/MagicMirror$
Edit: The
pm2 start mm
command can be run from any directory (I think) although this would not account for your mirror crashing as your described -
@Mykle1 I was using pm2 start, npm from the directory seems to work fine. Am trying some forum posts like https://stackoverflow.com/questions/24468041/npm-install-gives-error-cant-find-a-package-json-file but nothing has worked yet.
-
Seeing that the last thing you were doing was “just playing around with stopping and starting with PM2, all was good. But I tried rebooting the pi to check the autoboot” let’s assume that PM2 is the problem. There are 2 common missed steps when installing PM2.
-
is when the terminal actually gives you a command that you have to execute immediately after it is presented by the terminal.
-
The other is not saving the state of PM2, in which case, it would not function properly, if at all.
I’m not saying this is what happened. I’m just trying to narrow it down a bit
-
-
-
@cruunnerr said in Error: ENOENT: no such file or directory, open ‘package.json’:
Unfortunately the pm2 start command can NOT be used in every direction.
Tell that to my mirror, which executes
pm2 start mm
andpm2 stop mm
in ANY directory. -
@cruunnerr @Mykle1 You both are right.
@cruunnerr is executing the Shell script, which must be executed in the same directory as the script is located in, except you define the path in the
pm2
command like thispm2 start /path/to/script.sh
(also given, the script used absolute paths, or can handle the “remote” execution)@Mykle1 You are executing the
pm2
“deamon”, which can be executed everywhere