Error: ENOENT: no such file or directory, open 'package.json'
Benlism last edited by
I have installed MM for the first time (Raspberry Pi 3 Model and everything seemed to be working fine, just playing around with stopping and starting with PM2, all was good. But I tried rebooting the pi to check the autoboot and MM does not work at all any more. It goes briefly to the MM loading screen before crashing and going to the normal pi screen. When I try to boot through terminal the MM loading screen does not show and nothing comes up. The error log gives this message:
Error: ENOENT: no such file or directory, open 'package.json' at Object.fs.openSync (fs.js:646:18) at Object.fs.readFileSync (fs.js:551:33) at Object. (/home/pi/MagicMirror/js/app.js:15:32) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Module.require (module.js:587:17) at require (internal/module.js:11:18)
I am pretty new to all this and it is the first time I have used JS.
An ENOENT error usually indicates that a command was issued in the wrong directory. This would occur if you were trying to run
npm startin a directory other than
pm2 start mmcommand can be run from any directory (I think) although this would not account for your mirror crashing as your described
Benlism last edited by
@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 last edited by cruunnerr
Unfortunately the pm2 start command can NOT be used in every direction. It must be used in the same direction where the “mm.sh” is. So if u create the mm.sh in your home directory u must also use “pm2 start mm.sh” in your home directory.
(Just to know)
Unfortunately the pm2 start command can NOT be used in every direction.
Tell that to my mirror, which executes
pm2 start mmand
pm2 stop mmin ANY directory.
@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
pm2command like this
pm2 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