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.

    Fetch is not a function

    Scheduled Pinned Locked Moved Solved Troubleshooting
    7 Posts 3 Posters 1.4k 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.
    • Hein-JanH Offline
      Hein-Jan
      last edited by Hein-Jan

      Dear all,

      I have just update to 2.20.0 on an Ubuntu 20.04.3 LTS.

      The news feed states “Geen nieuws op dit moment” sorry Dutch version, translated: “no news at this moment”.

      The mm-error.log states “fetch is not a function” at fetchNews (/home/…/modules/default/newsfeed/newsfeedfetcher.js:88:3)

      The changes for 2.20.0 by MichMich state:
      Use internal fetch function of node instead external node-fetch library if used node version >= v18.

      node -v results in V14.19.3.

      I think I am almost at solving the problem, but I am also way out of my depth here.

      How do I get the newsfeed to “fetch” again on an Ubuntu 20.04.3 LTS mirror?
      Help is apreciated.

      Kind Regards,

      Hein-Jan

      Sorry. Made a mess of package.json and package-lock.json files, and subsequently made a mess of the update.
      Problem has been solved.

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @Hein-Jan
        last edited by sdetweil

        @Hein-Jan update fails if any of our files are changed.

        git status will show you the changed files, if any

        git diff will show you WHAT changed in each changed file…

        package-lock is regenerated, and thus changed

        package.json is usually not changed, but needs to be for windows and pi0w.
        you cannot restore the older package.json onto the newer release, as it contains the version info for the mm dependencies which change every release.

        I recommend using my upgrade script.
        see https://github.com/sdetweil/MagicMirror_scripts
        it will call out the changes and save them if need be (if u say yes).

        but that explains the trouble, mismatched dependencies…

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        M Hein-JanH 2 Replies Last reply Reply Quote 0
        • S Offline
          sdetweil @Hein-Jan
          last edited by

          @Hein-Jan what did u do to fix this?

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          Hein-JanH 1 Reply Last reply Reply Quote 0
          • Hein-JanH Offline
            Hein-Jan @sdetweil
            last edited by

            @sdetweil

            I always struggle with the updates. The first time it fails because it tells me to store a package.json and and a package-lock.json. I renamed them by adding “_old”. The second time the updated ran its course.
            As i am ignorant, the I renamed the new package.json and package-lock.json by adding “_new”, and renamed the “_old” ones into the package.json and package-lock.json.
            Then I ran the npm install.
            That’s when I ran into trouble and called for help.
            Further study of the log showed me that I was still running 2.17, which indicated something had gone wrong with the update, so I now renamed the “_new” files into package.json and package-lock.json, and redid the npm install. That solved the fetch problem.
            It just gave me a valid-url and and another problem, but I simply installed these modules again, they always seem to be gone after an update in the Ubuntu install.

            To be honest I do not know why the updates halts and tells me to store the (or something) the package.json and package-lock.json files, when it needs the new ones to run the update proper.
            To be honest I do not even know what the files do. They seem to be a record of the dependcies or something.
            Like I said: I am ignorant.

            Thanks for reading and replying to mu mail, I see that you help a lot of people. Hope this info helps you keeping up that service.

            Kind Regards,

            Hein-Jan

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @Hein-Jan
              last edited by sdetweil

              @Hein-Jan update fails if any of our files are changed.

              git status will show you the changed files, if any

              git diff will show you WHAT changed in each changed file…

              package-lock is regenerated, and thus changed

              package.json is usually not changed, but needs to be for windows and pi0w.
              you cannot restore the older package.json onto the newer release, as it contains the version info for the mm dependencies which change every release.

              I recommend using my upgrade script.
              see https://github.com/sdetweil/MagicMirror_scripts
              it will call out the changes and save them if need be (if u say yes).

              but that explains the trouble, mismatched dependencies…

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              M Hein-JanH 2 Replies Last reply Reply Quote 0
              • M Offline
                MMRIZE @sdetweil
                last edited by MMRIZE

                You need to update node version at least v18.
                I recommend using nvm to manage node versions.

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @MMRIZE
                  last edited by

                  @MMRIZE node 16 is acceptable.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • Hein-JanH Offline
                    Hein-Jan @sdetweil
                    last edited by

                    @sdetweil

                    Thanks for the clarification. Will try the script next time.

                    Hein-Jan

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • 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