Hello,
I am facing exactly the same issue. I am learning how to create nodes, and having this same error. the difference is, as far as I can see, that I am declaring correctly the call to the neccessary type (in my case 'example') from RED.nodes.registerType()
.
This is the log of node-red:
Welcome to Node-RED
===================
12 Apr 18:24:22 - [info] Node-RED version: v1.0.4
12 Apr 18:24:22 - [info] Node.js version: v12.16.1
12 Apr 18:24:22 - [info] Linux 4.15.0-1063-aws x64 LE
12 Apr 18:24:22 - [info] Loading palette nodes
12 Apr 18:24:23 - [info] Worldmap version 2.2.1
12 Apr 18:24:24 - [info] Dashboard version 2.19.4 started at /ui
12 Apr 18:24:24 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
12 Apr 18:24:24 - [info] Settings file : /home/usuario/.node-red/settings.js
12 Apr 18:24:24 - [info] Context store : 'storeInFile' [module=localfilesystem]
12 Apr 18:24:24 - [info] Context store : 'default' [module=memory]
12 Apr 18:24:24 - [info] User directory : /home/usuario/.node-red
12 Apr 18:24:24 - [info] Server now running at http://127.0.0.1:20481/
12 Apr 18:24:24 - [info] Active project : NodeRED
12 Apr 18:24:24 - [info] Flows file : /home/usuario/.node-red/projects/NodeRED/flows_raspberrypi.json
12 Apr 18:24:24 - [info] Waiting for missing types to be registered:
12 Apr 18:24:24 - [info] - example
This is the .js file:
module.export = function(RED) {
function ExampleNode(config) {
RED.nodes.createNode(this,config);
var node = this;
}
RED.nodes.registerType("example", ExampleNode);
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);
}
}
}
The .html:
<script type="text/javascript">
RED.nodes.registerType('example', {
color: "#62796E",
category: 'function',
defaults: {
name: {value:""}
},
inputs: 1,
outputs: 1,
icon: "inject.png",
label: function() {
return this.name || "example";
}
});
</script>
<script type="text/x-red" data-template-name="example">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name </label>
</div>
</script>
<script type="text/x-red" data-help-name="example">
<p>Converts msg.payload to a lower-case string.</p>
</script>
The package.json file:
{
"name": "node-red-contrib-example",
"version": "1.0.0",
"description": "",
"author": "",
"license": "ISC",
"node-red": {
"nodes": {
"example": "exampleNode.js"
}
}
}
It seems to be correctly loaded by node-red (fragment of : $HOME/.node-red/.config.json):
"node-red-contrib-example": {
"name": "node-red-contrib-example",
"version": "1.0.0",
"local": true,
"nodes": {
"example": {
"name": "example",
"types": [
"example"
],
"enabled": true,
"local": true,
"module": "node-red-contrib-example",
"file": "/home/maq/.node-red/node_modules/node-red-contrib-example/exampleNode.js"
}
}
}
},
Sorry I am sending a lot of data; just to show that I am considering all the possible mistakes commented here. After a number of hours trying different options, I haven't managed to put the node to work. I have to say that the node can be selected from the palette, but it cannot deploy the code as it says "Flows stopped due to missing node types."
Thanks a lot in advance