# Alternative Method for Supplying Custom Nodes in Node-RED

**URL:** <https://discourse.nodered.org/t/alternative-method-for-supplying-custom-nodes-in-node-red/81128>\
**Category:** Developing Nodes\
**Created:** [8 September 2023 01:06 UTC](https://discourse.nodered.org/t/alternative-method-for-supplying-custom-nodes-in-node-red/81128 "2023-09-08T01:06:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Backboard7880](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@Backboard7880](https://discourse.nodered.org/u/Backboard7880)\
**Post date:** [8 September 2023 01:06 UTC](https://discourse.nodered.org/t/alternative-method-for-supplying-custom-nodes-in-node-red/81128/1 "2023-09-08T01:06:34Z")

</div>

I've been working on a solution that involves using custom nodes in Node-RED. Initially, I set up my project with pnpm and had custom modules that shared dependencies within a monorepo. However, I've run into compatibility issues with how Node-RED loads modules when using this approach.

My custom nodes consist of some HTML and a function that is passed the `RED` object. I'm wondering if there's another way to supply custom nodes without packaging them as separate node modules.

Ideally, I'd like to do something like this:

```auto
RED.start();
myCustomNode(RED); // Start my custom nodes

```

Is this approach possible, and if so, what would be required to make it work with Node-RED's runtime?

Any insights or guidance on this matter would be greatly appreciated. Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Backboard7880](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@Backboard7880](https://discourse.nodered.org/u/Backboard7880)\
**Post date:** [8 September 2023 01:22 UTC](https://discourse.nodered.org/t/alternative-method-for-supplying-custom-nodes-in-node-red/81128/2 "2023-09-08T01:22:20Z")

</div>

RED.nodes.registerType("lookup-advance", ... );  
After running this. How could I supply the supporting HTML for the ui?

---

<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:** [8 September 2023 01:31 UTC](https://discourse.nodered.org/t/alternative-method-for-supplying-custom-nodes-in-node-red/81128/3 "2023-09-08T01:31:59Z")

</div>

Not really clear what you are trying to do. The startup of Node-RED is complex but only uses standard CommonJS `require`s. So if that isn't working with pnpm, I would say that is down to something that pnpm is doing different to standard.

The other way to run Node-RED is to embed it in your own Node.js app. This is documented as far as I remember and I think I've even done it in the dim and distant past. Not for many years though.

For custom nodes, Node-RED's loading is necessarily complex as it has to include the runtime code and then various parts of that code get executed at different points in the startup. I even created a dummy set of nodes that let me explore that process with debugging info. You can find the `jktesting` nodes on my GitHub.

> [@Backboard7880](#):
>
> My custom nodes consist of some HTML and a function that is passed the `RED` object

That is only the part of the Node that runs in the Editor. It isn't the runtime part of your node which is pure node.js JavaScript.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 November 2023 01:32 UTC](https://discourse.nodered.org/t/alternative-method-for-supplying-custom-nodes-in-node-red/81128/4 "2023-11-07T01:32:37Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
