Read the statement by Michael Teeuw here.
[ERROR] _ is not defined
-
@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.jsnode: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 -
i said stop
we need to fix nodejs so npm install will work
node -v
says something
and npm install says node is differenti am trying to figure out where node is installed and by who
system, nvm or nyou didn’t give me answers to the commands i provided
-
which node gave me
/home/MYMIRR/.nvm/versions/node/v22.15.0/bin/noden gave me
node/20.18.1Use 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
-
@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 .nvmnow which node
should find /usr/local/bin/nodenow we need n to get to node 22.14.0
sudo n 22.14.0now node -v
should return 22.14.0
if so, do
cd ~/MagicMirror npm installnow MagicMirror should run
-
@sdetweil Thank you a lot Sam.
I did everything but
I have an [ERROR] _ is not definedmagicmirror@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 -
@nowayto so that sounds like the npm install failed again
do it again and show the output
-
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-notifierInstalling 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-notifierInstalling 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
runnpm fundfor details -
@nowayto weird, and npm start fails again _ not defined?
i installed solarpicture without problems
-
@sdetweil
I’m sure.I don’t think SolarPicture could be the problem.Yes, the error keep showing
-
@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 -
@sdetweil
Before writing here I made backups, locally and on github, like you taught me in the past :)Now I’ll try
-
That’s incredible… I did it, everything goes good… no issues but when I start it
npm start
magicmirror@2.31.0 start
npm run start:x11magicmirror@2.31.0 start:x11
DISPLAY=“${DISPLAY:=:0}” ./node_modules/.bin/electron js/electron.js[2025-05-11 22:44:21.593] [LOG] Starting MagicMirror: v2.31.0
[2025-05-11 22:44:21.682] [LOG] Loading config …
[2025-05-11 22:44:21.687] [LOG] config template file not exists, no envsubst
[2025-05-11 22:44:23.250] [INFO] Checking config file /home/MYMIRR/MagicMirror/config/config.js …
[2025-05-11 22:44:23.532] [INFO] Your configuration file doesn’t contain syntax errors :)
[2025-05-11 22:44:23.535] [INFO] Checking modules structure configuration …
[2025-05-11 22:44:23.824] [ERROR] _ is not definedAgain this _ is not defined
-
@nowayto wow!!! NOW i am really confused.
have you rebooted?
if you try the sample config.js
cd ~/MagicMirror/config mv config.js config.js.save cp config.js.sample config.jsand then
npm startdoes it run or fail
-
@sdetweil
Sam… I don’t know how to saying it.
I figure out the issue.After your last message I tried what you suggest.
With the default cfg I had no errors, with mine I had errors.So I checked again and again the config…
and I find an underscore _ right at the start of the confignpm config:check told me “no syntax errors” and that confusing me.
When I edit it I use nano editor
I do “sudo nano config.js” and I press CTRL + _ to jump at the 250 line.
Might be one of the latest time I opened it and press _ a bit faster than CTRL and I add it for error.In addition I notice that when I open config.js with nano editor the green cursor is, clearly, at the start of the first line… EXACTLY on the undescore _ and it hides it.
I’m really sorry for bothering you with that.
How can I buy you a coffee ?
Thanks -
@nowayto no coffee needed, we found it!!!
please NEVER use sudo inside MagicMirror folder
no reason to use super user , just makes trouble laterso if you fix the config.js in the saved MagicMirror folder then it should run ok too!!!"
ill see what we can do about the misleading message… thanks for your energy here!!!
-
@nowayto i use ctrl-end on my keyboard for nano to get to end of file
haven’t found a way to do that on my chromebook, drives me crazy!!!
-
@nowayto ok, I’ve found the error producer
and I’ll propose a fix…I think this might have been more useful lol
[ERROR] fatal error in /home/sam/MagicMirror/config/config.js at line 19 column 1, _ is not definedI opened
https://github.com/MagicMirrorOrg/MagicMirror/issues/3785for this issue
-
@sdetweil Ok but I wanna just offer a coffe for your kind and your time spent with that.
Do you suggest me to fix the old magic mirror folder or just rm it?
-
@nowayto if you have everything working, you can rm it
i was just saying you could prove this change would fix the prior install
i do this for fun, really! pay it forward, help someone else on whatever when you can.
-
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