• 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.

Fetch is not a function

Scheduled Pinned Locked Moved Solved Troubleshooting
7 Posts 3 Posters 1.3k 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.
  • H Offline
    Hein-Jan
    last edited by Hein-Jan Jul 3, 2022, 4:11 PM Jul 3, 2022, 2:33 PM

    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 Jul 3, 2022, 5:37 PM Reply Quote 0
    • S Offline
      sdetweil @Hein-Jan
      last edited by sdetweil Jul 11, 2022, 6:15 AM Jul 11, 2022, 6:12 AM

      @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 H 2 Replies Last reply Jul 11, 2022, 8:47 AM Reply Quote 0
      • S Offline
        sdetweil @Hein-Jan
        last edited by Jul 3, 2022, 5:37 PM

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

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        H 1 Reply Last reply Jul 11, 2022, 5:50 AM Reply Quote 0
        • H Offline
          Hein-Jan @sdetweil
          last edited by Jul 11, 2022, 5:50 AM

          @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 Jul 11, 2022, 6:12 AM Reply Quote 0
          • S Offline
            sdetweil @Hein-Jan
            last edited by sdetweil Jul 11, 2022, 6:15 AM Jul 11, 2022, 6:12 AM

            @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 H 2 Replies Last reply Jul 11, 2022, 8:47 AM Reply Quote 0
            • M Offline
              MMRIZE @sdetweil
              last edited by MMRIZE Jul 11, 2022, 8:47 AM Jul 11, 2022, 8:47 AM

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

              S 1 Reply Last reply Jul 11, 2022, 11:28 AM Reply Quote 0
              • S Offline
                sdetweil @MMRIZE
                last edited by Jul 11, 2022, 11:28 AM

                @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
                • H Offline
                  Hein-Jan @sdetweil
                  last edited by Jul 11, 2022, 5:02 PM

                  @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