# Some nodes not showing up in flows.nodered.org

**URL:** https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500
**Category:** Developing Nodes
**Created:** [4 June 2024 14:05 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500 "2024-06-04T14:05:30Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![MoonDev](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@MoonDev](https://discourse.nodered.org/u/MoonDev)
#### Post date: [4 June 2024 14:05 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/1 "2024-06-04T14:05:30Z")

</div>

Hello,  
I'm developer of the @lunatone/node-red-dali package and there is the strange issue that on the [flows.nodered.org](http://flows.nodered.org) page of the package some nodes are not displayed in the nodes bubble anymore.  
Anyone knows how to fix this?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [4 June 2024 14:25 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/2 "2024-06-04T14:25:13Z")

</div>

Hi @MoonDev

As you have chosen not to provide any GitHub / support links to your repo - its incredibility difficult to debug (and for anyone to raise a support request in the future)

So, may be advise what Nodes you have registered in your `package.json`  
and the source code you have written to register these correctly.

Do note: The bubbles are based on (I believe) the registration you have provided in the html files, but the JS file must be registered in the package file

@knolleary - if I have that right?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [4 June 2024 14:26 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/3 "2024-06-04T14:26:12Z")

</div>

There is no link to the github repository for the module, so we cannot easily go and look at it to see if we can identify the problem.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [4 June 2024 14:27 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/4 "2024-06-04T14:27:12Z")

</div>

Personally I am not prepared to put the time in if there is no public repository.

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [4 June 2024 14:28 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/5 "2024-06-04T14:28:17Z")

</div>

Agreed!

But I can be flippant at times 😬

---

<div class="post-metadata">

### Author: ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)
#### Post date: [4 June 2024 14:51 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/6 "2024-06-04T14:51:13Z")

</div>

Not quite right,  
When updating the package, the content is parsed by a Regex in order to find all the `registerType` in script sections in HTML files.

Your problem is:

 ![Capture d’écran 2024-06-04 à 16.47.59](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/25d7c0827c85520190e17c45cf53d23bb3ab56af.png)

---

<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: [4 June 2024 14:52 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/7 "2024-06-04T14:52:51Z")

</div>

HI @MoonDev

The flow library attempts to parse the node html files to identify what nodes are contained - also allowing it to try to get the icon/colour right etc.

For security, it doesn't run any of the code, so is reliant on parsing the content to spot the calls to `registerType`. It isn't a perfect approach, and does fail to spot some nodes. For example, modules that dynamically generate the content, or that load the content for additional files.

Nick

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [4 June 2024 14:56 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/8 "2024-06-04T14:56:21Z")

</div>

It reads the `package.json` file to understand what HTML files it needs to parse.  
Unless it scans the whole package for `.html` files @knolleary?

if the former - the `package.json` is the first breadcrumb so to speak?

---

<div class="post-metadata">

### Author: ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)
#### Post date: [4 June 2024 14:59 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/9 "2024-06-04T14:59:26Z")

</div>

For me, only the `package.json` is read (to find html files).

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [4 June 2024 15:05 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/10 "2024-06-04T15:05:29Z")

</div>

> [@marcus-j-davies](#):
>
> So, may be advise what Nodes you have registered in your `package.json`  
> and the source code you have written to register these correctly.
> 
> Do note: The bubbles are based on (I believe) the registration you have provided in the html files, but the JS file must be registered in the package file

Hence ☝

Reads package file -\> enumerate the nodes in that package `xxxxxx.js`  
parse `xxxxxx.html` for the corresponding js file.

(This is just a guess mind you 😅 )

I do agree with Nick, the flow library thing is a bit left-field (with various things)

---

<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: [4 June 2024 15:20 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/11 "2024-06-04T15:20:52Z")

</div>

1. it reads package.json to identify the html files to scan - just as Node-RED itself does.
2. it parses the html files looking for the nodes.

It does this first by looking for `<script type="text/javascript> ... </script>` blocks via a regex. It then passes the contents of that into a JavaScript parser and then looks for the call to `registerType`. So it is a _bit_ smarter than just a regex match once it has found the script tags.  
Relevant code: [flow-library/lib/modules.js at master · node-red/flow-library · GitHub](https://github.com/node-red/flow-library/blob/master/lib/modules.js#L200)

---

<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: [4 June 2024 18:59 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/12 "2024-06-04T18:59:09Z")

</div>

> [@knolleary](#):
>
> It does this first by looking for `<script type="text/javascript> ... </script>` blocks via a regex

Does that mean that, if the registration is done in a resource file `<link>`d in the HTML rather than in-line, it won't find things?

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [4 June 2024 19:13 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/13 "2024-06-04T19:13:57Z")

</div>

@TotallyInformation

I believe that assumption is correct.

1. Targeting the HTML file : [flow-library/lib/modules.js at e103f7091c8c87699761ab5b9802fd7afd68c46d · node-red/flow-library · GitHub](https://github.com/node-red/flow-library/blob/e103f7091c8c87699761ab5b9802fd7afd68c46d/lib/modules.js#L322)

2. Reading the tag contents ONLY : [flow-library/lib/modules.js at e103f7091c8c87699761ab5b9802fd7afd68c46d · node-red/flow-library · GitHub](https://github.com/node-red/flow-library/blob/e103f7091c8c87699761ab5b9802fd7afd68c46d/lib/modules.js#L199)

---

<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: [4 June 2024 19:24 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/14 "2024-06-04T19:24:40Z")

</div>

> [@marcus-j-davies](#):
>
> I believe that assumption is correct.

Oops! Unfortunately, that is going to be a bit of a problem for any future releases of any of my nodes because I am/have decoupled the JS from the HTML.

I got really fed up of trying to manage 3 separate things in one HTML file. For a long time I split them in source and used an automation to recombine them on change. But that too was a rather a faff. So now the JS is loaded from a separate resource file.

This has some major advantages, especially for more complex nodes. Specifically, all of the Editor JavaScript code is now in a folder that contains no Node.js code. Meaning that I can now properly use ESLINT to validate the code. And, of course, having the JS separate makes the editing process easier anyway since you can have the HTML and the JS in separate edit windows in VSCode.

Even the panel HTML and the help HTML are in separate files because the help goes into a `locales` sub-folder. This too makes writing the documentation easier since you can cross-check against the main HTML it separate windows of your code editor.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/7/a766b327cc857be7f522f7a2f9abb304f66e1d8a.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/253d638a27875baac4163e04f66f8ae15237f91a.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/2/c2d2489e9af740d8a2f19c767aa02429ab11160c.png)

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [4 June 2024 20:47 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/15 "2024-06-04T20:47:00Z")

</div>

> [@marcus-j-davies](#):
>
> agree with Nick

Ah! there is an election debate tonight 🤣 🤣 🤣

---

<div class="post-metadata">

### Author: ![MoonDev](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@MoonDev](https://discourse.nodered.org/u/MoonDev)
#### Post date: [5 June 2024 06:48 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/16 "2024-06-05T06:48:49Z")

</div>

Thanks for all your responses!

Ok, this is probably the reason why some of my nodes are missing on the flows page. I'm using a script block with `type="module"` for some nodes because I wanted to import common code to use it in the html files. I thought I can do it this way because the nodes show up in the editor and are functional.

Is there any other way to do such thing?  
Specifically I would like to access a constant array of objects in my `js` file and the `html` file.

---

<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: [5 June 2024 08:18 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/17 "2024-06-05T08:18:46Z")

</div>

The main thing is whether your nodes work in node-red. If you have something that works for you - then great - I wouldn't change it.

---

<div class="post-metadata">

### Author: ![MoonDev](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@MoonDev](https://discourse.nodered.org/u/MoonDev)
#### Post date: [5 June 2024 12:05 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/18 "2024-06-05T12:05:28Z")

</div>

Sounds reasonable.

For the future would it make sense to extend this check for `registerType` to include this `<script type="module"> ... </script>` blocks as well?

---

<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: [5 June 2024 14:23 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/19 "2024-06-05T14:23:17Z")

</div>

> [@MoonDev](#):
>
> Is there any other way to do such thing?

While I'm not currently using modules (though that is a good thought and I should consider that), I am otherwise doing the same as yourself, this absolutely works as explained above.

> [@MoonDev](#):
>
> For the future would it make sense to extend this check for `registerType` to include this `<script type="module"> ... </script>` blocks as well?

Not just for type of `module`, this should work as well: `<script src="./resources/node-red-contrib-uibuilder/uib-file-list.js"></script>`

It seems like the flows site code needs a tweak to ensure that it picks up all of the nodes - actually I'm slightly confused (not difficult) why it doesn't simply use the data in the package.json - why does it need anything else?

---

<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: [5 June 2024 15:04 UTC](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500/20 "2024-06-05T15:04:16Z")

</div>

> [@TotallyInformation](#):
>
> why it doesn't simply use the data in the package.json - why does it need anything else?

The information in package.json is _not_ a list of nodes in the package. It is a list of the node _files_. A single file could contain multiple nodes. Plus it needs information about the node icon and colour so it can attempt to produce a roughly accurate looking node - information that is only provided in the call to `registerType`.

I have just pushed a fix that adds support for `type="module"` script blocks - and can confirm that works for your node @MoonDev . As the parsing is only done when a new version is added to the library, the next time you publish a new version, it should sort itself out.

@TotallyInformation you are technically right that we should treat bare `<script>` blocks as javascript - will push an update for that shortly.

[Next page](https://discourse.nodered.org/t/some-nodes-not-showing-up-in-flows-nodered-org/88500.md?page=2)
