Read the statement by Michael Teeuw here.
Add JS Code to the Mirror
-
@dnj0104 there is probably more to the error message this also happens when there is some library required by a module not found at startup
u can also run
npm run config:check
to review any syntax errors in the config.js file
-
@sdetweil said in Add JS Code to the Mirror:
npm run config:check
in magicmirror/modules
or in magicmirror/modules/mpd-module ?
Thinks the whole module has to be rebuilt…
-
@dnj0104 in MagicMirror
-
then I got
[2020-10-23 23:46:08.836] [INFO] Checking file... /home/pi/MagicMirror/config/config.js [2020-10-23 23:46:09.049] [INFO] Your configuration file doesn't contain syntax errors :)
-
@dnj0104 ok, so the error that causes the default config to load is caused by some other problem.
missing module, or some other failure
can u show the MM startup messages (from the window where you do npm start)
a module consists of the folder name
MMM-MPD
and its main js file
MMM-MPD.js
and inside MMM-MPD.js is the module register statement
Module.register("MMM-MPD", {
and in config.js
{ module: 'MMM-MPD',
this causes MM to look for the folder, filename and file contents in that order
SO, it SOUNDS like from a prior post, that the REAL name is
mod_client
(so there must be the right folder name, file name and file contents of
mod_clientif so, you can rename the folder (mv is the rename command on linux)
then in config.js you needmodule:'mod_client',
see the topic ‘How to add modules’ in my signature
-
@sdetweil said in Add JS Code to the Mirror:
mod_client
errors folder and file config.js (mmm-mpd) renamed to mod:
[2020-10-24 00:03:42.600] [ERROR] WARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: ReferenceError: NodeHelper is not defined at Object.<anonymous> (/home/pi/MagicMirror/modules/mod_client/node_helper.js:4:18) at Module._compile (internal/modules/cjs/loader.js:786:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10) at Module.load (internal/modules/cjs/loader.js:645:32) at Function.Module._load (internal/modules/cjs/loader.js:560:12) at Module.require (internal/modules/cjs/loader.js:685:19) at require (internal/modules/cjs/helpers.js:16:16) at loadModule (/home/pi/MagicMirror/js/app.js:134:17) at loadNextModule (/home/pi/MagicMirror/js/app.js:169:5) at /home/pi/MagicMirror/js/app.js:171:6 [2020-10-24 00:03:42.601] [LOG] Loading module helpers ... [2020-10-24 00:03:42.602] [LOG] No helper found for module: alert. [2020-10-24 00:03:42.603] [LOG] Initializing new module helper ... [2020-10-24 00:03:42.604] [LOG] Module helper loaded: updatenotification [2020-10-24 00:03:42.605] [LOG] No helper found for module: clock. [2020-10-24 00:03:42.616] [LOG] Initializing new module helper ... [2020-10-24 00:03:42.617] [LOG] Module helper loaded: calendar [2020-10-24 00:03:42.618] [LOG] No helper found for module: . [2020-10-24 00:03:42.619] [LOG] No helper found for module: currentweather. [2020-10-24 00:03:42.620] [LOG] No helper found for module: weatherforecast. [2020-10-24 00:03:42.621] [LOG] Initializing new module helper ... [2020-10-24 00:03:42.621] [LOG] Module helper loaded: newsfeed [2020-10-24 00:03:42.623] [ERROR] App threw an error during load [2020-10-24 00:03:42.625] [ERROR] ReferenceError: NodeHelper is not defined at Object.<anonymous> (/home/pi/MagicMirror/modules/mod_client/node_helper.js:4:18) at Module._compile (internal/modules/cjs/loader.js:786:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10) at Module.load (internal/modules/cjs/loader.js:645:32) at Function.Module._load (internal/modules/cjs/loader.js:560:12) at Module.require (internal/modules/cjs/loader.js:685:19) at require (internal/modules/cjs/helpers.js:16:16) at loadModule (/home/pi/MagicMirror/js/app.js:134:17) at loadNextModule (/home/pi/MagicMirror/js/app.js:169:5) at /home/pi/MagicMirror/js/app.js:171:6 [2020-10-24 00:03:42.627] [ERROR] Whoops! There was an uncaught exception... [2020-10-24 00:03:42.628] [ERROR] ReferenceError: NodeHelper is not defined at Object.<anonymous> (/home/pi/MagicMirror/modules/mod_client/node_helper.js:4:18) at Module._compile (internal/modules/cjs/loader.js:786:30)
------result---- dark—screen electron just showed black----------
roll back, Folder named to mod-client and in config.js and mpd_client.js to mod_client.
Result; electron start with no error all my modules shows, but not mod_client aka mpd_client -
@dnj0104 what MM version are you running on? this problem was fixed in 2.10
do this
from the MM foldercd ~/MagicMirror git checkout modules/node_modules/node_helper/index.js
-
I got version 20.13.0
from your git command i get output
pi@raspberrypi:~/MagicMirror $ git checkout modules/node_modules/node_helper/index.js error: pathspec 'modules/node_modules/node_helper/index.js' did not match any file(s) known to git
-
@dnj0104 can you do
cd ~/MagicMirror grep version package.json
-
yes and and result is
pi@raspberrypi:~/MagicMirror $ grep version package.json "version": "2.13.0",