# Making a custom node and getting ERROR : Waiting for missing types to be registered

**URL:** <https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964>\
**Category:** Developing Nodes\
**Created:** [14 March 2019 07:49 UTC](https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964 "2019-03-14T07:49:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rb2594](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rb2594/32/6759_2.png) [@rb2594](https://discourse.nodered.org/u/rb2594)\
**Post date:** [14 March 2019 07:49 UTC](https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964/1 "2019-03-14T07:49:31Z")

</div>

On my machine,  
nodejs version : 8.15.1  
npm version : 6.4.1

I have made a simple node that generates any random number.  
I'm sharing the sequence of steps that I did so that it becomes simple and easy for you to understand...(I have correctly followed the documentation link, `https://nodered.org/docs/creating-nodes/first-node`. Just for the sake I'm listing steps here..😅)

1. in an arbitrary folder **/nodered-random-num** performed _npm init_.
2. inserted this code in package.json file i.e.  
"node-red" : {  
"nodes" : {  
"random-num" : "nodes/random-num.js"  
}  
}
3. created _random-num.html_ and _random-num.js_ files inside **/nodes** folder
4. Now, I setup the npm link of folder **/nodered-random-num** inside **/.node-red** folder in my user-directory.
5. run _node-red_ command on cmd

log created on cmd is below.......

 ![Screenshot%20(64)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f246db85b513476027c37c524711e4dcca04150f.png)

when I do input from inject node, following error gets displayed on dev-console of browser....

 ![Screenshot%20(66)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/766033e2614fcb03d2b2c722b56894c787fa5154.png)

I have literally tried everything..like downgraded my npm, checked file _.config.json_ also where my **random-num** node is even present there but it is unable to fetch its type, I don't know 😐

Please help me guys! As I'm new to node-red, I was just trying to learn by creating my own example Any suggestion is helpful..

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 March 2019 09:47 UTC](https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964/2 "2019-03-14T09:47:18Z")

</div>

You need to add some debugging output to your node so that you can see where it is failing.

You need to get beyond the missing types issue. What this is saying is that your node cannot be require'd into Node-RED. That implies that there is an error in the code or something is missing from the code that Node-RED is reliant on.

---

<div class="post-metadata">

**Author:** ![rb2594](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rb2594/32/6759_2.png) [@rb2594](https://discourse.nodered.org/u/rb2594)\
**Post date:** [14 March 2019 09:55 UTC](https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964/3 "2019-03-14T09:55:05Z")

</div>

Thanks for your reply Sir...  
One output debug node is already there in the flow. The problem I'm facing is that when the flow is being deployed it is throwing error that _Flow stooped due to missing node type : random-num_

If flow does not get deployed, how can I see where it is failing

my random-num.js file is :

```auto
module.exports = function(RED) {
	"use strict";
	function RandomNode(num) {
		RED.nodes.createNode(this,num);
		this.property = num.property || "payload";
		var node = this;
		this.on("input", function(msg) {
            var val;
            val = Math.round(Math.random() * 100);
            console.log("random number : " + val + "\n");
            RED.util.setMessageProperty(msg,node.property,val);
	        console.log(" *****i m here*****");
	    node.send(msg);
		});
	}
		RED.nodes.registerType("random",RandomNode);
}

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 March 2019 10:17 UTC](https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964/4 "2019-03-14T10:17:57Z")

</div>

Please wrap code in back-ticks so that it is properly formatted.

I can't immediately see an error but hard to read without formatting and I need to get back to work. You will need to put some more debug statements in different places.

If it helps at all, I have an annotated example node called node-red-contrib-jktest. I've tried to put best practice into it.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [14 March 2019 10:51 UTC](https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964/5 "2019-03-14T10:51:04Z")

</div>

You code is registering a node of type `random`:

```javascript
RED.nodes.registerType("random",RandomNode);

```

Not `random-num` which is what your flow is waiting for.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [14 March 2019 11:08 UTC](https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964/6 "2019-03-14T11:08:19Z")

</div>

> [@rb2594](#):
>
> I'm sharing the sequence of steps...

The very first step should be to see if one exists already by checking on [flows.nodered.org](http://flows.nodered.org) - and then to see if it saves you having to write any code in the first place :-)...

Next step is then to see if fixing/enhancing one of the existing ones would make it do what you want - in which case use that as a starting point... or better - offer to make changes to the original so it is improved for all.

And then... break out the editor and build your own. Have fun and good luck !

---

<div class="post-metadata">

**Author:** ![rb2594](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rb2594/32/6759_2.png) [@rb2594](https://discourse.nodered.org/u/rb2594)\
**Post date:** [14 March 2019 11:18 UTC](https://discourse.nodered.org/t/making-a-custom-node-and-getting-error-waiting-for-missing-types-to-be-registered/8964/7 "2019-03-14T11:18:37Z")

</div>

Got it @knolleary sir...really thanks a lot.  
I hadn't understood the syntax at first place even.

@dceejay and @TotallyInformation thank you for the advice Sir  
😃
