Read the statement by Michael Teeuw here.
Even a simple node_help.js example does not run.
-
@emrhssla said in Even a simple node_help.js example does not run.:
also, you need to install the python-shell component…
need a package.json file
{ "name": "MMM-Testpython", "description": "sample", "version": "0.0.1", "dependencies": { "python-shell": "latest" } }
and then run
npm install
in the module folder
the updated node_helper.js is
var NodeHelper = require("node_helper"); var {PythonShell} = require('python-shell'); module.exports = NodeHelper.create({ start: function() {}, socketNotificationReceived: function(notification, payload) { console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload); }, })
and produces this message in the terminal window, when the UI component is clicked
MMM-Testpython received a socket notification: TEST - Payload: [object Object]
-
Is it normal for these errors to occur?
/modules/MMM-Testpython/package.json -
@sdetweil said in Even a simple node_help.js example does not run.:
console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
var NodeHelper = require("node_helper"); //var {PythonShell} = require('python-shell'); module.exports = NodeHelper.create({ start: function() {}, socketNotificationReceived: function(notification, payload) { console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload); }, })
omg… -
@emrhssla sorry, I had a name of “sample” when I did it. I guess the - is not allowed
-
@emrhssla that log is only from the module file. Not node_helper
-
{ "name": "MMMTestpython", "description": "samples", "version": "0.0.1", "dependencies": { "python-shell": "latest" } }
Do I have to change it like this and install it again? npm install
-
@emrhssla I don’t understand… mine worked perfectly
package.json
{ "name": "MMM-Testpython", "description": "sample", "keywords": [ " none" ], "version": "0.0.1", "dependencies": { "python-shell": "latest" } }
/MagicMirror/modules/MMM-Testpython$ npm install npm WARN MMM-Testpython@0.0.1 No repository field. npm WARN MMM-Testpython@0.0.1 No license field. added 1 package from 1 contributor and audited 1 package in 0.821s found 0 vulnerabilities odroid@odroid:~/MagicMirror/modules/MMM-Testpython$
what version of npm do you have
npm -v
-
This post is deleted! -
-
omg…