• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

node_helper.js is not working?

Scheduled Pinned Locked Moved Solved Troubleshooting
49 Posts 3 Posters 14.6k Views 3 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.
  • V Offline
    vandy2424 @sdetweil
    last edited by vandy2424 Feb 10, 2024, 3:35 AM Feb 10, 2024, 3:34 AM

    @sdetweil Yeah sure, the output actually looks the same even though I ran those commands:

    jackson@raspberrypi:~/Documents/MagicMirror/config $ ls -laF
    total 20
    drwxr-xr-x  2 jackson jackson 4096 Feb  9 19:19 ./
    drwxr-xr-x 18 jackson jackson 4096 Feb  2 10:27 ../
    -rwxrwxrwx  1 jackson jackson 1998 Feb  9 19:19 config.js*
    -rw-r--r--  1 jackson jackson 3534 Feb  2 10:27 config.js.sample
    -rw-r--r--  1 jackson jackson 1024 Feb  2 12:12 .config.js.swp
    

    And wow, its incredible you were able to find that. Thanks so much for the continuous help. Hopefully we are close!

    S 2 Replies Last reply Feb 10, 2024, 3:44 AM Reply Quote 0
    • S Offline
      sdetweil @vandy2424
      last edited by sdetweil Feb 10, 2024, 3:44 AM Feb 10, 2024, 3:44 AM

      @vandy2424 try this

      sudo chmod 644 config.js

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @vandy2424
        last edited by sdetweil Feb 10, 2024, 4:25 AM Feb 10, 2024, 4:18 AM

        @vandy2424 said in node_helper.js is not working?:

        Hopefully we are close!

        I can recreate it if I force the fs api call to fail… but I cannot get it to fail normally

        root, full permissions, still works…

        i can force it to fail the accessSync()

        with permissions 740, and owner/group as root

        but, i get an error message in the npm startup messages

        [09.02.2024 21:21.19.642] [DEBUG] config template file not exists, no envsubst
        [09.02.2024 21:21.19.642] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error: EACCES: permission denied, open '/home/pi/Documents/MagicMirror/config/config.js'
        

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        V 1 Reply Last reply Feb 10, 2024, 5:02 AM Reply Quote 0
        • V Offline
          vandy2424 @sdetweil
          last edited by vandy2424 Feb 10, 2024, 5:02 AM Feb 10, 2024, 5:02 AM

          @sdetweil Interesting. So it would seem my issue isn’t based with permissions of the config file but something else causing the config file to not be read/synced properly? It is strange that mine is “failing” normally, even though my permissions are correct.

          I tried sudo chmod 644 config.js and nothing changed.

          I wonder if its worth reinstalling MM at this point? Not sure what your take would be on that.

          S 1 Reply Last reply Feb 10, 2024, 5:11 AM Reply Quote 0
          • S Offline
            sdetweil @vandy2424
            last edited by sdetweil Feb 10, 2024, 5:12 AM Feb 10, 2024, 5:11 AM

            @vandy2424 I would try the normal path

            copy the config.js.sample to config.js

            mv config.js config.js.save
            cp config.js.sample config.js

            I also moved my MagicMirror folder under Documents. that had no effect

            you can disable modules with

            disabled: true,
            after the module: line

            so you don’t have to delete the content…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            V 1 Reply Last reply Feb 10, 2024, 2:12 PM Reply Quote 1
            • V Offline
              vandy2424 @sdetweil
              last edited by vandy2424 Feb 10, 2024, 2:14 PM Feb 10, 2024, 2:12 PM

              @sdetweil Wow so I’m a bit confused on this but its working. So I ran those commands and just started by running the default config.js from config.js.sample that had been copied over and all the modules worked (including calendar which includes a node_helper.js module).

              Whats interesting is when I tried copying the contents of my old config.js over to the new config.js, I actually got the same backend log as before:

              [10.02.2024 07:51.49.862] [LOG]   Starting MagicMirror: v2.26.0
              [10.02.2024 07:51.49.873] [LOG]   Loading config ...
              [10.02.2024 07:51.49.879] [DEBUG] config template file not exists, no envsubst
              [10.02.2024 07:51.49.887] [LOG]   Loading module helpers ...
              [10.02.2024 07:51.49.944] [LOG]   Initializing new module helper ...
              [10.02.2024 07:51.49.947] [LOG]   Module helper loaded: updatenotification
              [10.02.2024 07:51.49.949] [LOG]   No helper found for module: helloworld.
              [10.02.2024 07:51.49.950] [LOG]   All module helpers loaded.
              [10.02.2024 07:51.49.969] [LOG]   Starting server on port 8080 ...
              [10.02.2024 07:51.50.435] [LOG]   Server started ...
              [10.02.2024 07:51.50.438] [LOG]   Connecting socket for: updatenotification
              [10.02.2024 07:51.50.440] [LOG]   Starting module helper: updatenotification
              [10.02.2024 07:51.50.441] [LOG]   Sockets connected & modules started ...
              [10.02.2024 07:51.50.471] [LOG]   Launching application.
              

              Where as, when only manually editing the config contents copied over from the config.js.sample file, and only enabling the same modules as were being used in my old config (just disabled others), now the output looks like this (which I assume is what were looking for):

              
              [10.02.2024 08:02.54.899] [LOG]   Starting MagicMirror: v2.26.0
              [10.02.2024 08:02.54.909] [LOG]   Loading config ...
              [10.02.2024 08:02.54.915] [DEBUG] config template file not exists, no envsubst
              [10.02.2024 08:02.54.923] [LOG]   Loading module helpers ...
              [10.02.2024 08:02.54.925] [LOG]   No helper found for module: clock.
              [10.02.2024 08:02.55.227] [LOG]   Initializing new module helper ...
              [10.02.2024 08:02.55.228] [LOG]   Module helper loaded: calendar
              [10.02.2024 08:02.55.230] [LOG]   No helper found for module: weather.
              [10.02.2024 08:02.55.444] [LOG]   Initializing new module helper ...
              [10.02.2024 08:02.55.446] [LOG]   Module helper loaded: newsfeed
              [10.02.2024 08:02.55.447] [LOG]   All module helpers loaded.
              [10.02.2024 08:02.55.463] [LOG]   Starting server on port 8080 ...
              [10.02.2024 08:02.55.967] [LOG]   Server started ...
              [10.02.2024 08:02.55.970] [LOG]   Connecting socket for: calendar
              [10.02.2024 08:02.55.971] [LOG]   Starting node helper for: calendar
              [10.02.2024 08:02.55.973] [LOG]   Connecting socket for: newsfeed
              [10.02.2024 08:02.55.975] [LOG]   Starting node helper for: newsfeed
              [10.02.2024 08:02.55.977] [LOG]   Sockets connected & modules started ...
              [10.02.2024 08:02.56.003] [LOG]   Launching application.
              [10.02.2024 08:03.02.349] [LOG]   Create new calendarfetcher for url: https://ics.calendarlabs.com/76/mm3137/US_Holidays.ics - Interval: 604800000
              [10.02.2024 08:03.02.626] [LOG]   Create new newsfetcher for url: https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml - Interval: 300000
              [10.02.2024 08:03.03.472] [INFO]  Calendar-Fetcher: Broadcasting 11 events from https://ics.calendarlabs.com/76/mm3137/US_Holidays.ics.
              [10.02.2024 08:03.05.342] [INFO]  Newsfeed-Fetcher: Broadcasting 24 items.
              

              Granted, there is some other lines that came from the sample js that are included that weren’t in my config, but im still confused on the magic that happened here. Maybe I had a really weird formatting error causing something in the code to be out of scope? Id be curious if you had an idea of why this is the case. It was almost like that old config.js may have been corrupted in some way. Either way, this is a huge step in the right direction (in theory its working).

              Im going to try and add back non-default modules 1 by 1 to this new config and update in this post here soon.

              S 1 Reply Last reply Feb 10, 2024, 3:34 PM Reply Quote 0
              • S Offline
                sdetweil @vandy2424
                last edited by sdetweil Feb 10, 2024, 3:39 PM Feb 10, 2024, 3:34 PM

                @vandy2424 ok, got it…

                the last line of the model (sample) config.js is critical

                /*************** DO NOT EDIT THE LINE BELOW ***************/
                if (typeof module !== "undefined") { module.exports = config; }
                

                because it was NOT there in yours,
                when we loaded the config using require()
                it returned {} (nothing)
                and the default was used, this is why no error was shown…

                file existed, was loaded successfully, but had no data

                my install script copies the config.js.sample to config.js so users most likely woudn’t experience this

                see https://github.com/sdetweil/MagicMirror_scripts

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                V 1 Reply Last reply Feb 10, 2024, 6:14 PM Reply Quote 1
                • V Offline
                  vandy2424 @sdetweil
                  last edited by Feb 10, 2024, 6:14 PM

                  @sdetweil Wow! Can’t believe it all came down to one line of code (as it always seems to do).

                  I went ahead and tested adding those other modules and they work! Everything seems to be working great now. I really appreciate all the help and the patience to get through this. Grateful they’re people like you in the community to help! :)

                  S 1 Reply Last reply Feb 12, 2024, 6:11 PM Reply Quote 0
                  • S Offline
                    sdetweil @vandy2424
                    last edited by sdetweil Feb 14, 2024, 1:37 AM Feb 12, 2024, 6:11 PM

                    @vandy2424 I have provided a ‘fix’, that will produce a message if this case happens again… hopefully next release (April 1)

                    https://github.com/MagicMirrorOrg/MagicMirror/pull/3383

                    edit: the fix was accepted for next release

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 1
                    • 1
                    • 2
                    • 3
                    • 4
                    • 5
                    • 5 / 5
                    5 / 5
                    • First post
                      43/49
                      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