Read the statement by Michael Teeuw here.
Electron error: Cannot find module 'envsub'
-
Hi there,
my MM unfortunately does not load anymore.
I already installed envsub via npm which did not help.Is there anyone who has an idea what this could be?
Thank you very much, greatly appreciated!
The logs state the following:
0|mm | App threw an error during load 0|mm | Error: Cannot find module 'envsub' 0|mm | Require stack: 0|mm | - /home/user/MagicMirror/js/app.js 0|mm | - /home/user/MagicMirror/js/electron.js 0|mm | - /home/user/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js 0|mm | - 0|mm | at Module._resolveFilename (node:internal/modules/cjs/loader:963:15) 0|mm | at n._resolveFilename (node:electron/js2c/browser_init:2:109416) 0|mm | at Module._resolveFilename (/home/user/MagicMirror/node_modules/module-alias/index.js:49:29) 0|mm | at Module._load (node:internal/modules/cjs/loader:811:27) 0|mm | at f._load (node:electron/js2c/asar_bundle:2:13328) 0|mm | at Module.require (node:internal/modules/cjs/loader:1035:19) 0|mm | at require (node:internal/modules/cjs/helpers:102:18) 0|mm | at Object.<anonymous> (/home/user/MagicMirror/js/app.js:13:16) 0|mm | at Module._compile (node:internal/modules/cjs/loader:1141:14) 0|mm | at Module._extensions..js (node:internal/modules/cjs/loader:1196:10) 0|mm | A JavaScript error occurred in the main process 0|mm | Uncaught Exception: 0|mm | Error: Cannot find module 'envsub' 0|mm | Require stack: 0|mm | - /home/user/MagicMirror/js/app.js 0|mm | - /home/user/MagicMirror/js/electron.js 0|mm | - /home/user/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js 0|mm | - 0|mm | at Module._resolveFilename (node:internal/modules/cjs/loader:963:15) 0|mm | at n._resolveFilename (node:electron/js2c/browser_init:2:109416) 0|mm | at Module._resolveFilename (/home/user/MagicMirror/node_modules/module-alias/index.js:49:29) 0|mm | at Module._load (node:internal/modules/cjs/loader:811:27) 0|mm | at f._load (node:electron/js2c/asar_bundle:2:13328) 0|mm | at Module.require (node:internal/modules/cjs/loader:1035:19) 0|mm | at require (node:internal/modules/cjs/helpers:102:18) 0|mm | at Object.<anonymous> (/home/user/MagicMirror/js/app.js:13:16) 0|mm | at Module._compile (node:internal/modules/cjs/loader:1141:14) 0|mm | at Module._extensions..js (node:internal/modules/cjs/loader:1196:10) 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to open kms_swrast (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri) 0|mm | failed to load driver: kms_swrast 0|mm | MESA-LOADER: failed to open swrast (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri) 0|mm | failed to load swrast driver
-
@asd ok, got it.
you forgot the second step of upgrade
git pull && npm install
you MUST run npm install
and POSSIBLY. have to run npm install or electron-rebuild in all the installed modules
due to the possible nodejs change and electron change. -
-
@sdetweil thanks for your help.
The MagicMirror was running well on git commit f14e956 from Feb, 7th 2023.
When I upgraded viagit pull
within the ~/MagicMirror folder, the miror would not start anymore.Hence I tried to reverse the git pull via
git reset --hard f14e956
which unfortunately did not help either.Besides this, I previously ran the standard
apt update && upgrade -y
. However, the mirror worked fine when restarting after this viapm2 restart mm
. S o I do not think it was based of this.For reference, I run MM on a Raspberry Pi 4.
-
@asd ok, got it.
you forgot the second step of upgrade
git pull && npm install
you MUST run npm install
and POSSIBLY. have to run npm install or electron-rebuild in all the installed modules
due to the possible nodejs change and electron change. -
@sdetweil awesome. It works again. Thank you very much. greatly appreciated!
I have done my updates like this before and seem to have forgotten it this time.
-
I have the same problem. I updated using
git pull && npm run install-mm
I also ran npm install in each module, only 1 seemed to update. Rebooted and still get same error:
@raspberrypi:~/MagicMirror $ npm run start > magicmirror@2.23.0 start > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js App threw an error during load Error: Cannot find module 'envsub' Require stack: - /home/pi/MagicMirror/js/app.js - /home/pi/MagicMirror/js/electron.js - /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js - at Module._resolveFilename (node:internal/modules/cjs/loader:963:15) at n._resolveFilename (node:electron/js2c/browser_init:2:109416) at Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29) at Module._load (node:internal/modules/cjs/loader:811:27) at f._load (node:electron/js2c/asar_bundle:2:13328) at Module.require (node:internal/modules/cjs/loader:1035:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/pi/MagicMirror/js/app.js:13:16) at Module._compile (node:internal/modules/cjs/loader:1141:14) at Module._extensions..js (node:internal/modules/cjs/loader:1196:10) A JavaScript error occurred in the main process Uncaught Exception: Error: Cannot find module 'envsub' Require stack: - /home/pi/MagicMirror/js/app.js - /home/pi/MagicMirror/js/electron.js - /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js - at Module._resolveFilename (node:internal/modules/cjs/loader:963:15) at n._resolveFilename (node:electron/js2c/browser_init:2:109416) at Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29) at Module._load (node:internal/modules/cjs/loader:811:27) at f._load (node:electron/js2c/asar_bundle:2:13328) at Module.require (node:internal/modules/cjs/loader:1035:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/pi/MagicMirror/js/app.js:13:16) at Module._compile (node:internal/modules/cjs/loader:1141:14) at Module._extensions..js (node:internal/modules/cjs/loader:1196:10) MESA-LOADER: failed to retrieve device information MESA-LOADER: failed to retrieve device information MESA-LOADER: failed to retrieve device information MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri) failed to load driver: kms_swrast MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri) failed to load swrast driver ^C/home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT
Any other ideas?
Thanks -
@Roncham I can only say that the npm run did not work
from the MagicMirror folder do
npm install --omit=dev
-
@sdetweil said in Electron error: Cannot find module 'envsub':
npm install --omit=dev
That worked thank you!