Read the statement by Michael Teeuw here.
MMM-Fitbit throwing an error
-
I followed the procedure - the module is reading client id and secret right, but failts in a following way.
[10:59:56.939] [LOG] Set credential request recieved. [10:59:56.945] [LOG] { client_id: 'XXXXXX', client_secret: 'XXXXXXXX' } [10:59:56.968] [LOG] Whoops! There was an uncaught exception... [10:59:56.969] [ERROR] TypeError: PythonShell.run is not a function at Class.setCreds (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:32:15) at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:18:9) at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11) at Socket.emit (events.js:182:13) at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12 at process._tickCallback (internal/process/next_tick.js:61:11) [10:59:56.974] [LOG] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? [10:59:56.977] [LOG] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
It shows the icons in UI, but does not show stats. Also results in mirror crashing after a while. What am I missing?
-
@nakulbende looks like mmm-fitbit has a faulty setup…
the pyhton-shell module dependency wasn’t installed for it…
from the code in node_helper.jsvar PythonShell = require('python-shell');
to fix do
change to the MMM-Fitbit foldernpm install python-shell
the author should have provided a package.json to handle this, with instructions for npm install
there was a security fix added in the npm code, if a module (in node_modules) is found, but not referenced by a package.json dependency, that module is removed (in case someone is trying to sneak stuff into the runtime to steal data)this will happen to you again
-
I opened issue https://github.com/SVendittelli/MMM-fitbit/issues/28
in the module github to try to get this fixed by the author or someone -
It is still giving me an error:
[09:34:25.018] [LOG] Whoops! There was an uncaught exception... [09:34:25.020] [ERROR] TypeError: PythonShell.run is not a function at Class.setCreds (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:32:15) at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:18:9) at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:113:11) at Socket.emit (events.js:182:13) at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12 at process._tickCallback (internal/process/next_tick.js:61:11) [09:34:25.026] [LOG] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? [09:34:25.029] [LOG] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues [09:34:25.136] [LOG] Initial run request recieved. [09:34:25.139] [LOG] Running getData.py [09:34:25.143] [LOG] Whoops! There was an uncaught exception... [09:34:25.146] [ERROR] TypeError: PythonShell is not a constructor at Class.getData (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:43:25) at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:22:9) at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:113:11) at Socket.emit (events.js:182:13) at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12 at process._tickCallback (internal/process/next_tick.js:61:11) [09:34:25.148] [LOG] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? [09:34:25.150] [LOG] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
This is my output of npm install (usually the log for npm audit fix too):
pi@magicmirror:~/MagicMirror/modules/MMM-fitbit $ sudo npm install python-shell -f npm WARN using --force I sure hope you know what you are doing. npm WARN saveError ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/package.json' npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/package.json' npm WARN modules No description npm WARN modules No repository field. npm WARN modules No README data npm WARN modules No license field. + python-shell@1.0.8 updated 1 package and audited 391 packages in 3.359s 1 package is looking for funding run `npm fund` for details found 0 vulnerabilities
I was able to solve this by invoking
npm init
and generating a new package.json file. Now, the output to installing pythoin-shell waspi@magicmirror:~/MagicMirror/modules/MMM-fitbit $ sudo npm install python-shell -f npm WARN using --force I sure hope you know what you are doing. npm notice created a lockfile as package-lock.json. You should commit this file. + python-shell@1.0.8 added 1 package from 1 contributor and audited 1 package in 1.4s found 0 vulnerabilities
No cigar, I still get the above error on
npm install
-
@nakulbende there is no ‘error’… just warnings and dumb warnings (no package.json file, yeh so what!),.
sadly it looks like this module is way out of date and not updated…
there was another user here creating a new fitbit module
see here
https://forum.magicmirror.builders/topic/12029/what-is-the-procedure-for-reviving-a-dead-module