MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    PM2 does not start the Magic Mirror

    Scheduled Pinned Locked Moved Solved Troubleshooting
    pm2errorenoent
    15 Posts 5 Posters 16.5k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      DarioCas
      last edited by

      Hi!

      I recently wanted to build a magicmirror.

      I installed the Magicmirror software and also automatically pm2.

      Everything worked fine. The Magicmirror came up.
      Then i rebooted the Raspberry.
      From there on pm2 didn’t work anymore.
      This was in the log:

      
      
      :::
      
      //Error: ENOENT: no such file or directory, open 'package.json'
      
      :::
      
      
      

      Does someone know what i have to do?

      Regards

      Dario Casciato

      bheplerB 1 Reply Last reply Reply Quote 0
      • bheplerB Offline
        bhepler Module Developer @DarioCas
        last edited by bhepler

        @dariocas - First, check to see if anything pm2 related still exists on your Pi: type pm2 status all. If you get a table in reply, then pm2 is there, you just need to configure it.

        If you get “command not found” then you’ll need to install pm2 manually: npm install pm2 -g. Once that finishes, you’ll want to initalize pm2 with pm2 startup. It will do a mess of things and at the end it will output a command for you to enter. This is important! You need to copy that command from the output and paste it into the command line. That will enable pm2 to start when the Pi reboots.

        Give it a go and let us know what you find.

        1 Reply Last reply Reply Quote 1
        • lavolp3L Offline
          lavolp3 Module Developer
          last edited by

          Dario, what was the command that created this error message.
          You need to give us a bit more information

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

          D 1 Reply Last reply Reply Quote 0
          • D Offline
            DarioCas @lavolp3
            last edited by

            @lavolp3 this was in the LOG of pm2:

            Error ENOENT no such file or directory, open ‘packages.json’

            I think the command was open packages.json

            lavolp3L 1 Reply Last reply Reply Quote 0
            • lavolp3L Offline
              lavolp3 Module Developer @DarioCas
              last edited by

              @dariocas So the error message was created on startup of the mirror? And the mirror did not start?
              Can you start the mirror without pm2?

              cd ~/MagicMirror
              npm start dev
              

              Can you post the complete log of the process?
              Can you post what is inside the file that was created for the pm2 process?

              Still not enough information to help, sorry.

              How to troubleshoot modules
              MMM-soccer v2, MMM-AVStock

              D 1 Reply Last reply Reply Quote 0
              • D Offline
                DarioCas @lavolp3
                last edited by

                @lavolp3 The Mirror does start if i start it manually.

                this is the whole error log:

                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.<anonymous> (/home/pi/MagicMirror/js/app.js:15:32)
                    at Module._compile (module.js:652:30)
                    at Object.Module._extensions..js (module.js:663:10)
                    at Module.load (module.js:565:32)
                    at tryModuleLoad (module.js:505:12)
                    at Function.Module._load (module.js:497:3)
                    at Module.require (module.js:596:17)
                    at require (internal/module.js:11:18)
                

                and this is the log out:

                > magicmirror@2.6.0 start /home/pi/MagicMirror
                > sh run-start.sh
                
                Starting MagicMirror: v2.6.0
                Loading config ...
                Loading module helpers ...
                No helper found for module: alert.
                Initializing new module helper ...
                Module helper loaded: updatenotification
                No helper found for module: clock.
                Initializing new module helper ...
                Module helper loaded: calendar
                No helper found for module: compliments.
                No helper found for module: currentweather.
                No helper found for module: weatherforecast.
                Initializing new module helper ...
                Module helper loaded: newsfeed
                All module helpers loaded.
                Starting server on port 8080 ... 
                Server started ...
                Connecting socket for: updatenotification
                Connecting socket for: calendar
                Starting node helper for: calendar
                Connecting socket for: newsfeed
                Starting module: newsfeed
                Sockets connected & modules started ...
                Launching application.
                Create new calendar fetcher for url: http://www.calendarlabs.com/templates/ical/US-Holidays.ics - Interval: 300000
                Create new news fetcher for url: http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml - Interval: 300000
                Shutting down server...
                Stopping module helper: updatenotification
                Stopping module helper: calendar
                Stopping module helper: newsfeed
                
                

                These are the logs of pm2.
                The Mirror does not start if i start it from pm2.

                thanks for helping! :)

                1 Reply Last reply Reply Quote -1
                • K Offline
                  Klinge
                  last edited by

                  I have the same problem.

                  I installed a fresh MM with pm2. The MM started. But after a reboot the MM does not start automatically.

                  Unfortunately I have no idea.

                  It would be grateful, if someone could help me.

                  Thank you in advance

                  1 Reply Last reply Reply Quote 0
                  • lavolp3L Offline
                    lavolp3 Module Developer
                    last edited by

                    I would suggest to both of you to follow the complete guide setting up pm2 and the autostart again. It doesn’t take long.

                    Besides that, what does

                    pm2 status
                    

                    give you after reboot?

                    How to troubleshoot modules
                    MMM-soccer v2, MMM-AVStock

                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      Klinge
                      last edited by

                      pm2 status is

                      pi@raspberrypi:~ $ pm2 status
                      
                      │ Name        │ id │ mode  │ status │ ↺      │ cpu │ memory 
                      │ MagicMirror │ 0  │ 2.6.0 │ fork   │ online │ 799 │ 0%     │ 16.8 MB   │
                      
                       Use `pm2 show <id|name>` to get more details about an app
                      

                      and in pm2 log I get this every two seconds

                      pi@raspberrypi:~/.pm2 $ tail -f pm2.log
                      2019-02-15T15:36:47: PM2 log: App [MagicMirror:0] online
                      2019-02-15T15:36:48: PM2 log: App [MagicMirror:0] exited with code [1] via signal [SIGINT]
                      

                      I tried the complete guide with creating an .sh-File and so on. But unfortenately with the same effect.

                      lavolp3L 1 Reply Last reply Reply Quote 1
                      • lavolp3L Offline
                        lavolp3 Module Developer @Klinge
                        last edited by lavolp3

                        @klinge can you first do

                        pm2 stop all
                        

                        and then

                        cd ~/MagicMirror
                        npm start dev
                        

                        Maybe you can see what happens there.
                        It seems that pm2 is running the magicmirror start script but MagicMirror won’t start

                        How to troubleshoot modules
                        MMM-soccer v2, MMM-AVStock

                        D 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy