# Just can't get external modules to load properly on function node

**URL:** <https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215>\
**Category:** General\
**Tags:** docker, function-node\
**Created:** [13 April 2024 05:08 UTC](https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215 "2024-04-13T05:08:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sosukeinu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sosukeinu/32/90141_2.png) [@sosukeinu](https://discourse.nodered.org/u/sosukeinu)\
**Post date:** [13 April 2024 05:08 UTC](https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215/1 "2024-04-13T05:08:59Z")

</div>

Hello,

I'm running Node-Red version 1.3.9 using Docker. I am binding the `/data` directory to a local folder. No problems there. I've edited settings, and installed custom nodes through the palette manager, and everything is working.

However, when I add any module to the setup tab of a function node, I can't get it to find the installed package.

I confirm that the package is correctly added to the `packages.json` file, and the files are downloaded and present in the `/data/node_modules` folder. It's almost like they are just being ignored.

I'm hoping I'm just missing something obvious.

Thank you for any kind of troubleshooting advice you can offer.

---

<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:** [13 April 2024 06:41 UTC](https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215/2 "2024-04-13T06:41:17Z")

</div>

Welcome to the forum @sosukeinu

Please select the Function node and Export it, and paste it here so we can look at what you have done.

> [@sosukeinu](#):
>
> I can't get it to find the installed package.

What error are you seeing and where?

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [13 April 2024 06:51 UTC](https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215/3 "2024-04-13T06:51:13Z")

</div>

> [@sosukeinu](#):
>
> Node-Red version 1.3.9

?? A bit old ??

---

<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:** [13 April 2024 16:16 UTC](https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215/4 "2024-04-13T16:16:37Z")

</div>

@krambriw is right, that is a very old version. Please upgrade to to the latest (3.1.9) and see if that fixes it. If not then do as I suggested earlier.

---

<div class="post-metadata">

**Author:** ![sosukeinu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sosukeinu/32/90141_2.png) [@sosukeinu](https://discourse.nodered.org/u/sosukeinu)\
**Post date:** [13 April 2024 16:59 UTC](https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215/5 "2024-04-13T16:59:54Z")

</div>

Okay,....first of all, I'm an idiot, I swapped the numbers around in the version. I AM on 3.1.9, not 1.3.9. _smacks forehead_. Also, I kept digging. I think the issue is with the module I'm trying to load. It does not include a "main", nor "exports" in it's `packages.json`. I'm thinking that might be the issue.

Here is the flow so you can confirm that I'm not crazy.

Thank you very much for your help.

```auto
[
    {
        "id": "350783714c1c3545",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "639c99602972cf3c",
        "type": "function",
        "z": "350783714c1c3545",
        "name": "GeoJSON Circle from 2 Points",
        "func": "node.warn(\"loaded\")\nconst range = (start, stop, step = 1) =>\n Array(Math.ceil((stop - start) / step)).fill(start).map((x, y) => x + y * step)\n\nif ('circle' in msg.payload) {\n const angles = range(0, 360, 10)\n const gc = msg.payload.circle\n const centerpoint = [gc[0].lat, gc[0].lon]\n const outerpoint = [gc[1].lat, gc[1].lon]\n const distance = [centerpoint, outerpoint]\n\n\n msg.debug = {\n \"const angles\": angles,\n \"const gc\": gc,\n \"const centerpoint\": centerpoint,\n \"const distance\": distance\n }\n}\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [
            {
                "var": "geodesy",
                "module": "geodesy"
            }
        ],
        "x": 630,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "6802b087b5bca1d5",
        "type": "inject",
        "z": "350783714c1c3545",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 300,
        "y": 460,
        "wires": [
            [
                "639c99602972cf3c"
            ]
        ]
    }
]

```

---

<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:** [13 April 2024 17:12 UTC](https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215/6 "2024-04-13T17:12:06Z")

</div>

> [@sosukeinu](#):
>
> I think the issue is with the module I'm trying to load

I think you may well be correct, I see the same problem. It needs someone with more knowledge than myself of how this all works to comment...

---

<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:** [12 July 2024 17:12 UTC](https://discourse.nodered.org/t/just-cant-get-external-modules-to-load-properly-on-function-node/87215/7 "2024-07-12T17:12:35Z")

</div>

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