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.

    [ERROR] _ is not defined

    Scheduled Pinned Locked Moved Solved Troubleshooting
    36 Posts 3 Posters 9.0k 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.
    • S Offline
      sdetweil @nowayto
      last edited by sdetweil

      @nowayto i never suggest update automatically.
      use my script

      Sam

      How to add modules

      learning how to use browser developers window for css changes

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

        @sdetweil I’m sorry for the question: that script?

        bash -c “$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/upgrade-script.sh)”

        Thanks

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

          @nowayto yes, but its two steps

          one time without any parameters (test mode)
          and one time with apply

          all you have to do is click/copy the first time and run it
          then do the same on the second if the first ends successfully

          Sam

          How to add modules

          learning how to use browser developers window for css changes

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

            @sdetweil MM doesn’t work.

            I tried a config check but I have this error now.
            I tried to “npm install eslint -g” but the error persist

            npm run config:check

            magicmirror@2.31.0 config:check
            node js/check_config.js

            node:internal/modules/cjs/loader:1404
            throw err;
            ^

            Error: Cannot find module ‘eslint’
            Require stack:

            • /home/MYMIRR/MagicMirror/js/check_config.js
              at Module._resolveFilename (node:internal/modules/cjs/loader:1401:15)
              at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
              at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
              at Module._load (node:internal/modules/cjs/loader:1211:37)
              at TracingChannel.traceSync (node:diagnostics_channel:322:14)
              at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
              at Module.require (node:internal/modules/cjs/loader:1487:12)
              at require (node:internal/modules/helpers:135:16)
              at Object. (/home/MYMIRR/MagicMirror/js/check_config.js:6:20)
              at Module._compile (node:internal/modules/cjs/loader:1730:14) {
              code: ‘MODULE_NOT_FOUND’,
              requireStack: [ ‘/home/MYMIRR/MagicMirror/js/check_config.js’ ]
              }

            Node.js v22.15.0

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

              @nowayto show me the ~/MagicMirror/installers/upgrade.log

              note: I had a typo in log filename

              and then do

              cd ~/MagicMirror
              npm install
              

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              N 2 Replies Last reply Reply Quote 0
              • N Offline
                nowayto @sdetweil
                last edited by

                @sdetweil

                Upgrade started - Sat May 10 00:06:51 CEST 2025
                system is Linux magicmirror2 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux
                doing test run = true, NO updates will be applied!
                the os is PRETTY_NAME=“Raspbian GNU/Linux 11 (bullseye)” NAME=“Raspbian GNU/Linux” VERSION_ID=“11” VERSION=“11 (bullseye)” VERSION_CODENAME=bullseye ID=raspbian ID_LIK>
                architecture from dpkg is armhf
                ^[[96mCheck current Node installation …^[[0m
                ^[[0mNode currently installed. Checking version number.
                ^[[0mMinimum Node version: ^[[1mv22.14.0^[[0m
                ^[[0mInstalled Node version: ^[[1mv22.15.0^[[0m
                ^[[92mNo Node.js upgrade necessary.^[[0m
                ^[[96mCheck current NPM installation …^[[0m
                ^[[0mNPM currently installed. Checking version number.
                ^[[0mMinimum npm version: ^[[1mV10.9.2^[[0m
                ^[[0mInstalled npm version: ^[[1mV11.3.0^[[0m
                ^[[92mNo npm upgrade necessary.^[[0m

                saving custom.css
                remote name = origin
                upgrading from version 2.31.0 to 2.31.0
                fetching latest revisions
                git fetch rc=0
                current branch = master
                On branch master
                Your branch is up to date with ‘origin/master’.

                Untracked files:
                (use “git add …” to include in what will be committed)
                core
                errorcal.txt
                errorcal2.txt
                errorcal3.txt
                errorcal4.txt
                errorcal5.txt
                nohup.out
                run-start.sh
                splashscreen/

                nothing added to commit but untracked files present (use “git add” to track)
                no files different from github version

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

                  @sdetweil npm install results

                  ~/MagicMirror $ npm install
                  npm error code ENOTEMPTY
                  npm error syscall rename
                  npm error path /home/MYMIRR/MagicMirror/node_modules/es-abstract
                  npm error dest /home/MYMIRR/MagicMirror/node_modules/.es-abstract-fSsKyNTi
                  npm error errno -39
                  npm error ENOTEMPTY: directory not empty, rename ‘/home/MYMIRR/MagicMirror/node_modules/es-abstract’ -> ‘/home/MYMIRR/MagicMirror/node_modules/.es-abstract-fSsKyNTi’
                  npm error A complete log of this run can be found in: /home/MYMIRR/.npm/_logs/2025-05-10T06_40_55_661Z-debug-0.log

                  Tried with sudo

                  ~/MagicMirror $ sudo npm install
                  npm error code EBADENGINE
                  npm error engine Unsupported engine
                  npm error engine Not compatible with your version of node/npm: magicmirror@2.31.0
                  npm error notsup Not compatible with your version of node/npm: magicmirror@2.31.0
                  npm error notsup Required: {“node”:“>=22.14.0”}
                  npm error notsup Actual: {“npm”:“11.2.0”,“node”:“v20.18.1”}
                  npm error A complete log of this run can be found in: /root/.npm/_logs/2025-05-10T06_41_52_949Z-debug-0.log

                  npm seems to see an old version of nodejs but:

                  ~/MagicMirror $ node -v
                  v22.15.0

                  I don’t know what happened.
                  If it can help I had first problem after the MMM-SolarPicture
                  but I’ve just installed it and configured it through config.js… nothing more than usual…

                  but the actual behaviour is that pm2 status says it’s running, but on the monitor I see just the raspbian desktop

                  │ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
                  ├────┼───────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
                  │ 0 │ mm │ default │ N/A │ fork │ 4311 │ 19s │ 64 │ online │ 0% │ 2.6mb │ ber… │ disabled │

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

                    @nowayto two things

                    doing test run = true, NO updates will be applied!
                    upgrading from version 2.31.0 to 2.31.0

                    doing test run changes nothing, its a safety check

                    and i wont let you upgrade over the same release accidentally

                    so you need to rerun the command and add

                    force
                    

                    to the end

                    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

                      @nowayto NEVER use sudo with any npm command

                      the number in the pm2 status 4311 is the number of restarts

                      youve got a mess

                      now we HAVE to use sudo to undo it

                      cd ~/MagicMirror 
                      sudo rm -rf node_modules
                      cd fonts
                      sudo rm -rf node_modules
                      cd ..\vendor
                      sudo rm-rf node_modules
                      cd ..
                      

                      lets see about node

                      which node
                      n 
                      q to quit
                      nvm 
                      

                      dont do anything else til we figure out the nodejs problem

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

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

                        @sdetweil I’m sorry :(

                        I did it what you suggest and config:check gave me a module error again. Different than one before

                        npm run config:check

                        magicmirror@2.31.0 config:check
                        node js/check_config.js

                        node:internal/modules/cjs/loader:1404
                        throw err;
                        ^

                        Error: Cannot find module ‘ajv’
                        Require stack:

                        After “require stack” there are other lines, if you need it, tell me.
                        Thanks

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

                          @nowayto

                          i said stop

                          we need to fix nodejs so npm install will work

                          node -v

                          says something
                          and npm install says node is different

                          i am trying to figure out where node is installed and by who
                          system, nvm or n

                          you didn’t give me answers to the commands i provided

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

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

                            @sdetweil

                            which node gave me
                            /home/MYMIRR/.nvm/versions/node/v22.15.0/bin/node

                            n gave me
                            node/20.18.1

                            Use up/down arrow keys to select a version, return key to install, d to delete, q to quit

                            nvm gave me

                            Node Version Manager (v0.39.5)

                            Note: refers to any version-like string nvm understands. This includes :

                            • full or partial version numbers, starting with an optional “v” (0.10, v0.1.2 , v1)
                            • default (built-in) aliases: node, stable, unstable, iojs, system
                            • custom aliases you define with nvm alias foo

                            followed by a lot of options

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

                              @nowayto ok nvm and n do the same function but differently

                              i use n in my scripts because it runs everywhere

                              so lets turn off nvm

                              nvm deactivate
                              nvm unload
                              cd ~
                              rm -rf  .nvm
                              

                              now which node
                              should find /usr/local/bin/node

                              now we need n to get to node 22.14.0

                              sudo n 22.14.0
                              

                              now node -v

                              should return 22.14.0

                              if so, do

                              cd  ~/MagicMirror 
                              npm install
                              

                              now MagicMirror should run

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

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

                                @sdetweil Thank you a lot Sam.

                                I did everything but
                                I have an [ERROR] _ is not defined

                                magicmirror@2.31.0 start:x11
                                DISPLAY=“${DISPLAY:=:0}” ./node_modules/.bin/electron js/electron.js

                                [2025-05-11 15:39:26.429] [LOG] Starting MagicMirror: v2.31.0
                                [2025-05-11 15:39:26.527] [LOG] Loading config …
                                [2025-05-11 15:39:26.537] [LOG] config template file not exists, no envsubst
                                [2025-05-11 15:39:28.154] [INFO] Checking config file /home/MYMIRR/MagicM irror/config/config.js …
                                [2025-05-11 15:39:28.478] [INFO] Your configuration file doesn’t contain syntax errors :)
                                [2025-05-11 15:39:28.482] [INFO] Checking modules structure configuration …
                                [2025-05-11 15:39:28.793] [ERROR] _ is not defined

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

                                  @nowayto so that sounds like the npm install failed again

                                  do it again and show the output

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

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

                                    @sdetweil

                                    installer didn’t failed, but this is the result now

                                    npm install

                                    magicmirror@2.31.0 postinstall
                                    npm run install-vendor && npm run install-fonts && echo "MagicMirror² installation finished successfully!
                                    "

                                    magicmirror@2.31.0 install-vendor
                                    echo "Installing vendor files …
                                    " && cd vendor && npm install --loglevel=error --no-audit --no-fund --no-update-notifier

                                    Installing vendor files …

                                    up to date in 7s

                                    magicmirror@2.31.0 install-fonts
                                    echo "Installing fonts …
                                    " && cd fonts && npm install --loglevel=error --no-audit --no-fund --no-update-notifier

                                    Installing fonts …

                                    up to date in 3s
                                    MagicMirror² installation finished successfully!

                                    magicmirror@2.31.0 prepare
                                    [ -f node_modules/.bin/husky ] && husky || echo no husky installed.

                                    up to date in 45s

                                    285 packages are looking for funding
                                    run npm fund for details

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

                                      @nowayto weird, and npm start fails again _ not defined?

                                      i installed solarpicture without problems

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

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

                                        @sdetweil
                                        I’m sure.I don’t think SolarPicture could be the problem.

                                        Yes, the error keep showing

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

                                          @nowayto wild, lets do this… intall MM again, but save the current…

                                          #backup MM config and modules list
                                          bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror-backup-restore/main/mm_backup.sh)"
                                          #rename the MagicMirror folder out of the way
                                          cd ~
                                          mv MagicMirror MagicMirror.save
                                          #and install MM again
                                          bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/raspberry.sh)"
                                          #restore the  MM config and modules
                                          bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror-backup-restore/main/mm_restore.sh)" 
                                          

                                          then

                                          cd ~/MagicMirror
                                          npm start 
                                          

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

                                          N 2 Replies Last reply Reply Quote 0
                                          • N Offline
                                            nowayto @sdetweil
                                            last edited by

                                            @sdetweil
                                            Before writing here I made backups, locally and on github, like you taught me in the past :)

                                            Now I’ll try

                                            1 Reply Last reply Reply Quote 1

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