I have managed to see the problem; .js code was wrong. Two errors:
- Using module.export instead of module.exports
- Code inside exported function was not correc. This is teh correct version:
module.exports = function(RED) {
"use strict";
function ExampleNode(config) {
RED.nodes.createNode(this,config);
var node = this;
this.on("input"), function(msg) {
if (typeof msg.payload === "string") {
msg.payload = msg.payload.toLowerCase();
node.send(msg);
} else {
node.error("Payload is not a String", msg);
}
}
}
RED.nodes.registerType("example", ExampleNode);
};
What is difficult to me is to detect these kind of errors: java script is too permisive with data, so you can declare or use data out of scope, and nothing happens. Thanks