Read the statement by Michael Teeuw here.
Cannot find module 'undici' - 'npm install' doesn't work
-
Hi,
since today my MMM don´t start.
When I start it, I got the following error message
pi@raspberrypi:~/MagicMirror $ display=:0 npm start > magicmirror@2.30.0 start > npm run start:x11 > magicmirror@2.30.0 start:x11 > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js [2025-01-02 09:01:37.931] [ERROR] App threw an error during load [2025-01-02 09:01:37.938] [ERROR] Error: Cannot find module 'undici' Require stack: - /home/pi/MagicMirror/js/app.js - /home/pi/MagicMirror/js/electron.js at Module._resolveFilename (node:internal/modules/cjs/loader:1055:15) at s._resolveFilename (node:electron/js2c/browser_init:2:115476) at Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29) at Module._load (node:internal/modules/cjs/loader:908:27) at c._load (node:electron/js2c/node_init:2:13672) at Module.require (node:internal/modules/cjs/loader:1122:19) at require (node:internal/modules/helpers:130:18) at Object.<anonymous> (/home/pi/MagicMirror/js/app.js:15:40) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1311:10) at Module.load (node:internal/modules/cjs/loader:1098:32) at Module._load (node:internal/modules/cjs/loader:945:12) at c._load (node:electron/js2c/node_init:2:13672) at Module.require (node:internal/modules/cjs/loader:1122:19) at require (node:internal/modules/helpers:130:18) at Object.<anonymous> (/home/pi/MagicMirror/js/electron.js:4:14) A JavaScript error occurred in the main process
When I try “npm install” I got the following
pi@raspberrypi:~/MagicMirror $ npm install npm error code EBADENGINE npm error engine Unsupported engine npm error engine Not compatible with your version of node/npm: magicmirror@2.30.0 npm error notsup Not compatible with your version of node/npm: magicmirror@2.30.0 npm error notsup Required: {"node":">=20.18.1 <21 || >=22"} npm error notsup Actual: {"npm":"10.8.2","node":"v18.20.5"} npm error A complete log of this run can be found in: /home/pi/.npm/_logs/2025-01-02T08_02_32_005Z-debug-0.log
So I tried to update my npm with
sudo apt update sudo apt full-upgrade sudo apt remove node sudo apt remove nodejs sudo apt install nodejs
but npm has still the version 10.8.2
So, what have I done wrong?
It would be really nice, if you have some advice for me.
Thank you in advance.
Kind regards
Klinge -
@Klinge yes it says we need node 20.18.1 or above
https://forum.magicmirror.builders/topic/19271/version-2-30-0-requires-updated-nodejs-warning-for-pi0w-installationsanyhow quickest way
install tool to allow changing node versionssudo npm install n -g sudo n 20.18.1
now do the MagicMirror install
cd ~/MagicMirror npm run install-mm
-
@Klinge also, next time use my upgrade script
-
@sdetweil Thank you for your help.
After updating to 20.18.1 unfortunately I get the following error
pi@raspberrypi:~/MagicMirror $ pwd /home/pi/MagicMirror pi@raspberrypi:~/MagicMirror $ npm run install-mm node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)
And yes, the next time I will use your upgrade script ;-)
-
@Klinge you are on buster os… you need to upgrade to a later version, as that library is not available on buster… my script would have told you that…
use my backup/restore scripts
https://github.com/sdetweil/MagicMirror-backup-restoreto be able to quickly move to new OS
use install script to install MM on new os
https://github.com/sdetweil/MagicMirror_scripts
and then restore to put back MM config and modules(and upgrade script next time)
-
@sdetweil Shit, that’s the same problem I had with my second mirror a few weeks ago. Well, it’s been running fine since 2016.
Many thanks for your tips. With your scripts I’ll quickly install the new one. -
@Klinge if you had started w my script it would have told you so you didn’t have to upgrade NOW . sorry
the whole objective of my scripts is to prevent this exact scenario. broke system.