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.

    Cannot find module "moment"

    Scheduled Pinned Locked Moved Troubleshooting
    98 Posts 2 Posters 54.4k Views 2 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.
    • U Offline
      uok825 @sdetweil
      last edited by uok825

      @sdetweil said in Cannot find module "moment":

      grep version package.json

      Version 2.12.0
      85bb21bf-e3ae-4175-a147-e431cedf5e7f-image.png

      S 2 Replies Last reply Reply Quote 0
      • S Offline
        sdetweil @uok825
        last edited by sdetweil

        @uok825 run the upgrade script from installers
        like u were doing

        or run just the curl… part of the whole command so we can see the error

        Sam

        How to add modules

        learning how to use browser developers window for css changes

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

          @sdetweil NEVER EVER SUDO!!!

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          U 1 Reply Last reply Reply Quote 0
          • U Offline
            uok825 @sdetweil
            last edited by uok825

            @sdetweil Okey im sorry. Now run just

            curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/upgrade-script.sh
            

            c9ccfe87-2fd2-464c-843d-e3b2620af791-image.png

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

              @uok825

              cd ~
              MagicMirror/installers/upgrade-script.sh apply
              

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              U 1 Reply Last reply Reply Quote 0
              • U Offline
                uok825 @sdetweil
                last edited by

                @sdetweil 0ac068d6-c12e-4b8a-8052-f77778b56ae2-image.pngAccess denied

                S 2 Replies Last reply Reply Quote 0
                • S Offline
                  sdetweil @uok825
                  last edited by sdetweil

                  @uok825 ah, didn’t mark executable

                  cd ~
                  chmod +x MagicMirror/installers/upgrade-script.sh
                  MagicMirror/installers/upgrade-script.sh apply
                  

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  U 1 Reply Last reply Reply Quote 0
                  • U Offline
                    uok825 @sdetweil
                    last edited by

                    @sdetweil said in Cannot find module "moment":

                    MagicMirror/installers/upgrade-script.sh apply

                    d3b8ef45-0c75-4b56-8579-62f0d55c9c2f-image.png

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

                      @uok825 when I do the curl i get

                      curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/upgrade-script.sh
                      #!/bin/bash
                      # only DO npm installs when flag is set to  1
                      # test when set to 0
                      true=1
                      .......
                      plus all the rest of the script.
                      

                      u have a networking problem going on …

                      warning, upgrade might fail as IT will try to download new files too

                      yes, the upgrade uses curl to get the new package.json file to check the version

                      remote_version=$(curl -s https://raw.githubusercontent.com/MichMich/MagicMirror/master/package.json
                      

                      and it also fails…

                      SO… u need to solve that… are you using pihole somewhere?

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      U 2 Replies Last reply Reply Quote 0
                      • U Offline
                        uok825 @sdetweil
                        last edited by

                        @sdetweil AHHHHHHH! Just remembered my other raspberry is stuck on internet too. I change my router so my router adress is changed from 192.168.1.1 to 192.168.1.3 but in my /etc/dhcpcd.conf 37c38ff5-5fcd-4f9b-83c0-5dac86ded6f4-image.png still 192.168.1.1 here sorry for bother you. Trying again.

                        1 Reply Last reply Reply Quote 0
                        • U Offline
                          uok825 @sdetweil
                          last edited by

                          @sdetweil
                          Seems fine. Thanks now i rebooting machine and watch if there is a error.

                          pi@raspberrypi:~ $ bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetwe                                                                                                             il/MagicMirror_scripts/master/upgrade-script.sh)" apply
                          No LSB modules are available.
                          doing test run = false
                          update log will be in /home/pi/MagicMirror/installers/upgrade.log
                          
                          saving custom.css
                          upgrading from version 2.12.0 to 2.16.0
                          fetching latest revisions
                          remote: Enumerating objects: 4413, done.
                          remote: Counting objects: 100% (3550/3550), done.
                          remote: Compressing objects: 100% (1006/1006), done.
                          remote: Total 2836 (delta 1962), reused 2490 (delta 1660), pack-reused 0
                          Receiving objects: 100% (2836/2836), 967.15 KiB | 156.00 KiB/s, done.
                          Resolving deltas: 100% (1962/1962), completed with 207 local objects.
                          From https://github.com/MichMich/MagicMirror
                             10dc315f..26a76f80  master     -> origin/master
                           * [new tag]           v2.16.0    -> v2.16.0
                           * [new tag]           v2.15.0    -> v2.15.0
                          updating MagicMirror runtime, please wait
                          npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@                                                                                                             1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my                                                                                                              best with it!
                          
                          > core-js@3.15.1 postinstall /home/pi/MagicMirror/node_modules/core-js
                          > node -e "try{require('./postinstall')}catch(e){}"
                          
                          Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfill                                                                                                             ing JavaScript standard library!
                          
                          The project needs your help! Please consider supporting of core-js on Open Colle                                                                                                             ctive or Patreon:
                          > https://opencollective.com/core-js
                          > https://www.patreon.com/zloirock
                          
                          Also, the author of core-js ( https://github.com/zloirock ) is looking for a goo                                                                                                             d job -)
                          
                          
                          > electron@11.4.9 postinstall /home/pi/MagicMirror/node_modules/electron
                          > node install.js
                          
                          HTTPError: Response code 404 (Not Found) for https://github.com/electron/electro                                                                                                             n/releases/download/v11.4.9/electron-v11.4.9-linux-armv6l.zip
                              at EventEmitter.emitter.on.response (/home/pi/MagicMirror/node_modules/got/s                                                                                                             ource/as-stream.js:35:24)
                              at EventEmitter.emit (events.js:198:13)
                              at module.exports (/home/pi/MagicMirror/node_modules/got/source/get-response                                                                                                             .js:22:10)
                              at ClientRequest.handleResponse (/home/pi/MagicMirror/node_modules/got/sourc                                                                                                             e/request-as-event-emitter.js:155:5)
                              at Object.onceWrapper (events.js:286:20)
                              at ClientRequest.emit (events.js:203:15)
                              at ClientRequest.origin.emit.args [as emit] (/home/pi/MagicMirror/node_modul                                                                                                             es/@szmarczak/http-timer/source/index.js:37:11)
                              at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21                                                                                                             )
                              at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17)
                              at TLSSocket.socketOnData (_http_client.js:451:20)
                          
                          > magicmirror@2.16.0 install /home/pi/MagicMirror
                          > echo "Installing vendor files ...
                          " && cd vendor && npm install --loglevel=error
                          
                          Installing vendor files ...
                          
                          
                          > @fortawesome/fontawesome-free@5.15.3 postinstall /home/pi/MagicMirror/vendor/n                                                                                                             ode_modules/@fortawesome/fontawesome-free
                          > node attribution.js
                          
                          Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
                          License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL                                                                                                              1.1, Code: MIT License)
                          
                          added 1 package from 1 contributor, removed 74 packages, updated 5 packages and                                                                                                              audited 9 packages in 83.089s
                          found 0 vulnerabilities
                          
                          
                          > magicmirror@2.16.0 postinstall /home/pi/MagicMirror
                          > npm run install-fonts && echo "MagicMirror installation finished successfully!                                                                                                             
                          "
                          
                          
                          > magicmirror@2.16.0 install-fonts /home/pi/MagicMirror
                          > echo "Installing fonts ...
                          " && cd fonts && npm install --loglevel=error
                          
                          Installing fonts ...
                          
                          audited 1 package in 7.24s
                          found 0 vulnerabilities
                          
                          MagicMirror installation finished successfully!
                          
                          npm WARN optional SKIPPING OPTIONAL DEPENDENCY: electron@11.4.9 (node_modules/el                                                                                                             ectron):
                          npm WARN optional SKIPPING OPTIONAL DEPENDENCY: electron@11.4.9 postinstall: `no                                                                                                             de install.js`
                          npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
                          
                          added 67 packages from 88 contributors, removed 489 packages, updated 98 package                                                                                                             s and audited 923 packages in 621.679s
                          
                          34 packages are looking for funding
                            run `npm fund` for details
                          
                          found 0 vulnerabilities
                          
                          processing dependency changes for active modules with package.json files
                          
                          processing for module MMM-MyPrayerTimes please wait
                          ----------------------------------
                          npm notice created a lockfile as package-lock.json. You should commit this file.
                          added 2 packages from 6 contributors and audited 2 packages in 16.096s
                          found 0 vulnerabilities
                          
                          processing complete for module MMM-MyPrayerTimes
                          
                          processing for module MMM-LICE please wait
                          ----------------------------------
                          npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
                          npm WARN deprecated har-validator@5.1.5: this library is no longer supported
                          npm notice created a lockfile as package-lock.json. You should commit this file.
                          added 64 packages from 69 contributors and audited 64 packages in 71.651s
                          
                          13 packages are looking for funding
                            run `npm fund` for details
                          
                          found 0 vulnerabilities
                          
                          processing complete for module MMM-LICE
                          
                          processing for module MMM-PIR please wait
                          ----------------------------------
                          
                          > epoll@2.0.10 install /home/pi/MagicMirror/modules/MMM-PIR/node_modules/epoll
                          > node-gyp rebuild
                          
                          make: Entering directory '/home/pi/MagicMirror/modules/MMM-PIR/node_modules/epoll/build'
                            CXX(target) Release/obj.target/epoll/src/epoll.o
                            SOLINK_MODULE(target) Release/obj.target/epoll.node
                            COPY Release/epoll.node
                          make: Leaving directory '/home/pi/MagicMirror/modules/MMM-PIR/node_modules/epoll/build'
                          npm notice created a lockfile as package-lock.json. You should commit this file.
                          added 6 packages from 9 contributors and audited 6 packages in 72.078s
                          found 0 vulnerabilities
                          
                          processing complete for module MMM-PIR
                          
                          restoring custom.css
                          
                          
                          S 1 Reply Last reply Reply Quote 0
                          • S Offline
                            sdetweil @uok825
                            last edited by

                            @uok825 cool… didn’t need to reboot… I would have asked u to check the package.json file start line

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            U 1 Reply Last reply Reply Quote 0
                            • U Offline
                              uok825 @sdetweil
                              last edited by uok825

                              @sdetweil
                              Now another module give an error

                              0|MagicMir | [26.07.2021 00:57.11.255] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error: Cannot find module 'uuid/v4'
                              0|MagicMir | [26.07.2021 00:57.11.503] [ERROR] Whoops! There was an uncaught exception...
                              0|MagicMir | [26.07.2021 00:57.11.562] [ERROR] { Error: Cannot find module 'uuid/v4'
                              0|MagicMir |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
                              0|MagicMir |     at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
                              0|MagicMir |     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
                              0|MagicMir |     at Module.require (internal/modules/cjs/loader.js:692:17)
                              0|MagicMir |     at require (internal/modules/cjs/helpers.js:25:18)
                              0|MagicMir |     at Object.<anonymous> (/home/pi/MagicMirror/node_modules/request/lib/auth.js:4:12)
                              0|MagicMir |     at Module._compile (internal/modules/cjs/loader.js:778:30)
                              0|MagicMir |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
                              0|MagicMir |     at Module.load (internal/modules/cjs/loader.js:653:32)
                              0|MagicMir |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' }
                              0|MagicMir | [26.07.2021 00:57.11.573] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                              0|MagicMir | [26.07.2021 00:57.11.584] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
                              
                              /home/pi/.pm2/logs/MagicMirror-out.log last 15 lines:
                              0|MagicMir | [26.07.2021 00:57.08.308] [LOG] Module helper loaded: newsfeed
                              0|MagicMir | [26.07.2021 00:57.11.270] [LOG] Loading module helpers ...
                              0|MagicMir | [26.07.2021 00:57.11.284] [LOG] No helper found for module: alert.
                              0|MagicMir | [26.07.2021 00:57.11.294] [LOG] Initializing new module helper ...
                              0|MagicMir | [26.07.2021 00:57.11.307] [LOG] Module helper loaded: updatenotification
                              0|MagicMir | [26.07.2021 00:57.11.316] [LOG] No helper found for module: clock.
                              0|MagicMir | [26.07.2021 00:57.11.330] [LOG] Initializing new module helper ...
                              0|MagicMir | [26.07.2021 00:57.11.340] [LOG] Module helper loaded: calendar
                              0|MagicMir | [26.07.2021 00:57.11.355] [LOG] Initializing new module helper ...
                              0|MagicMir | [26.07.2021 00:57.11.361] [LOG] Module helper loaded: currentweather
                              0|MagicMir | [26.07.2021 00:57.11.372] [LOG] Initializing new module helper ...
                              0|MagicMir | [26.07.2021 00:57.11.382] [LOG] Module helper loaded: weatherforecast
                              0|MagicMir | [26.07.2021 00:57.11.396] [LOG] Initializing new module helper ...
                              0|MagicMir | [26.07.2021 00:57.11.405] [LOG] Module helper loaded: newsfeed
                              0|MagicMir | Starting chromium browser now, have patience, it takes a minute
                              
                              

                              Internet is fine.
                              3245614a-1538-4e08-96a3-3ce8e4a04c62-image.png
                              Package.json
                              483d4e57-6a7a-4ac7-b28a-adfb32b4affb-image.png

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

                                @uok825 said in Cannot find module "moment":

                                /home/pi/MagicMirror/node_modules/request/lib/auth.js

                                looks like a library under request

                                cd ~/MagicMirror
                                npm install uuid
                                

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

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

                                  request and any lib that used request was removed in 2.16 as there was a security problem never to be fixed… so module was deprecated (set end of life)

                                  MagicMirror removed

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

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

                                    but the internet is working!!

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    U 1 Reply Last reply Reply Quote 0
                                    • U Offline
                                      uok825 @sdetweil
                                      last edited by

                                      @sdetweil Yeah. I also solved the other Raspberry and I know how to solve it here. We would try less if I don’t realize later. I’m sorry to have been ranting. I’m currently installing Uuid if the problem I will write again. Thanks for your labor Sam.

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

                                        @uok825 to shorten the path

                                        pm2 stop all

                                        then do

                                        npm start

                                        in the MagicMirror folder
                                        alt-spacebar, n to minimize MM
                                        then ctrl-c to stop

                                        once good, then pm2 status to get the number and
                                        pm2 start 0 or whatever number

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

                                        U 1 Reply Last reply Reply Quote 0
                                        • U Offline
                                          uok825 @sdetweil
                                          last edited by uok825

                                          @sdetweil I am connected with SSH. I always did pm2 stop 0, pm2 flush, do my work and pm2 start 0. But PI0 is so slow still doing npm :D

                                          S 2 Replies Last reply Reply Quote 0
                                          • S Offline
                                            sdetweil @uok825
                                            last edited by

                                            @uok825 but don’t need to do pm2 start until its working correctly

                                            why do you post screen shots if connected via ssh?/ just copy the text…

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            U 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 3 / 5
                                            • 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