# 'name' already registered by module node-red

**URL:** <https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504>\
**Category:** Developing Nodes\
**Tags:** docker, function-node\
**Created:** [4 June 2024 17:24 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504 "2024-06-04T17:24:03Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![marknomad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marknomad/32/91701_2.png) [@marknomad](https://discourse.nodered.org/u/marknomad)\
**Post date:** [4 June 2024 17:24 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/1 "2024-06-04T17:24:04Z")

</div>

I'm creating a new node for the first time in Node-RED. I ran through the tutorial on creating my first node to change the input to lowercase.

However, after installing the node, I always get `'name' already registered by module node-red`. I changed the name of my node several times, but this error still appears in both the pallet and the console.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9b8f182147f5961d3efe92350cdff90f3bc599b6.png)

> **Startup Logs**
>
> ```auto
> 4 Jun 17:19:11 - [info] 
> 2024-06-04T17:19:11.807805410Z 
> 2024-06-04T17:19:11.807809120Z Welcome to Node-RED
> 2024-06-04T17:19:11.807811230Z ===================
> 2024-06-04T17:19:11.807813100Z 
> 2024-06-04T17:19:11.808093868Z 4 Jun 17:19:11 - [info] Node-RED version: v3.1.4
> 2024-06-04T17:19:11.808317982Z 4 Jun 17:19:11 - [info] Node.js version: v16.20.2
> 2024-06-04T17:19:11.808397147Z 4 Jun 17:19:11 - [info] Linux 5.15.146.1-microsoft-standard-WSL2 x64 LE
> 2024-06-04T17:19:12.059360925Z 4 Jun 17:19:12 - [info] Loading palette nodes
> 2024-06-04T17:19:12.653989717Z 4 Jun 17:19:12 - [info] Dashboard version 3.6.2 started at /ui
> 2024-06-04T17:19:12.796686287Z 4 Jun 17:19:12 - [warn] ------------------------------------------------------
> 2024-06-04T17:19:12.797415818Z 4 Jun 17:19:12 - [warn] [node-red-contrib-ntc/ntc-test] 'ntc-test' already registered by module node-red
> 2024-06-04T17:19:12.797557282Z 4 Jun 17:19:12 - [warn] ------------------------------------------------------
> 2024-06-04T17:19:12.797874718Z 4 Jun 17:19:12 - [info] Settings file : /data/settings.js
> 2024-06-04T17:19:12.798382756Z 4 Jun 17:19:12 - [info] Context store : 'default' [module=memory]
> 2024-06-04T17:19:12.798927254Z 4 Jun 17:19:12 - [info] User directory : /data
> 2024-06-04T17:19:12.799051436Z 4 Jun 17:19:12 - [warn] Projects disabled : editorTheme.projects.enabled=false
> 2024-06-04T17:19:12.799298583Z 4 Jun 17:19:12 - [info] Flows file : /data/flows.json
> 2024-06-04T17:19:12.804582207Z 4 Jun 17:19:12 - [info] Server now running at https://127.0.0.1:1880/
> 2024-06-04T17:19:12.806099503Z [2024-06-04 17:19:12.805] [INFO] NodeRed FlowManager - Flow filtering state: []
> 2024-06-04T17:19:12.840321409Z 4 Jun 17:19:12 - [warn] Using unencrypted credentials
> 2024-06-04T17:19:12.876872884Z 4 Jun 17:19:12 - [info] Starting flows
> 2024-06-04T17:19:12.887547632Z 4 Jun 17:19:12 - [info] [mongodb4-client:58bf183a277d3721] client initialized with app name 'nodered-dzgvo3fk'
> 2024-06-04T17:19:13.014891560Z 4 Jun 17:19:13 - [info] Started flows
> 2024-06-04T17:19:13.016197118Z 4 Jun 17:19:13 - [info] [tcp in:From External] listening on port 8181
> 2024-06-04T17:19:13.076215388Z 4 Jun 17:19:13 - [info] [mqtt-broker:a5ac06f6.ba88c8] Connected to broker: nodered@mqtts://mqtt:8883
> 
> ```

What's odd is that I can still use the node within the Node-RED dashboard and it works, but this error still shows:

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

It's worth mentioning that I'm running this within a Docker container.  
Here is the basic lower-case node (but renamed):

> **ntc-test.js**
>
> ```auto
> module.exports = function(RED) {
> function NTCTestNode(config) {
> RED.nodes.createNode(this, config);
> var node = this;
> node.on('input', function(msg) {
> msg.payload = msg.payload.toLowerCase();
> node.send(msg);
> });
> }
> RED.nodes.registerType("ntc-test", NTCTestNode);
> }
> 
> ```

> **ntc-test.html**
>
> ```auto
> <script type="text/javascript">
> RED.nodes.registerType('ntc-test', {
> category: 'function',
> color: '#a6bbcf',
> defaults: {
> name: {value: ""}
> },
> inputs: 1,
> outputs: 1,
> icon: "file.svg",
> label: function () {
> return this.name || "ntc-test";
> }
> });
> </script>
> 
> <script type="text/html" data-template-name="ntc-test">
> <div class="form-row">
> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
> <input type="text" id="node-input-name" placeholder="Name">
> </div>
> </script>
> 
> <script type="text/html" data-help-name="ntc-test">
> <p>A simple node that converts the message payloads into all lower-case characters</p>
> </script>
> 
> ```

> **package.json**
>
> ```auto
> {
> "name": "node-red-contrib-ntc",
> "version": "1.0.0",
> "description": "Testing NTC",
> "scripts": {
> "test": "echo \"Error: no test specified\" && exit 1"
> },
> "keywords": [],
> "author": "",
> "license": "ISC",
> "node-red": {
> "nodes": {
> "ntc-test": "ntc-test.js"
> }
> },
> "devDependencies": {
> "@node-red/editor-api": "^3.1.9",
> "@node-red/nodes": "^3.1.9",
> "@node-red/runtime": "^3.1.9",
> "@node-red/util": "^3.1.9",
> "node-red": "^3.1.9"
> }
> }
> 
> ```

I appreciate any help!

---

<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 17:33 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/2 "2024-06-04T17:33:46Z")

</div>

What did you put in the node-red `package.json`?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 June 2024 17:50 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/3 "2024-06-04T17:50:20Z")

</div>

@marknomad - Why didn't you use a scoped name, as described in the Node-RED 'Creating nodes' documentation?  
[https://nodered.org/docs/creating-nodes/packaging](https://nodered.org/docs/creating-nodes/packaging)

---

<div class="post-metadata">

**Author:** ![marknomad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marknomad/32/91701_2.png) [@marknomad](https://discourse.nodered.org/u/marknomad)\
**Post date:** [4 June 2024 17:52 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/4 "2024-06-04T17:52:31Z")

</div>

This is my entry in the `/data/package.json`:  
`"node-red-contrib-ntc": "file:nodes"`

---

<div class="post-metadata">

**Author:** ![marknomad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marknomad/32/91701_2.png) [@marknomad](https://discourse.nodered.org/u/marknomad)\
**Post date:** [4 June 2024 17:53 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/5 "2024-06-04T17:53:40Z")

</div>

I haven't seen any other nodes use it so I wasn't aware that was a requirement and didn't see that article. I'll see about updating that; is it likely that it has anything to do with this issue?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 June 2024 17:55 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/6 "2024-06-04T17:55:55Z")

</div>

> [@marknomad](#):
>
> is it likely that it has anything to do with this issue

No, but I thought that I'd point it out, as it's easier to change name before others start using the node.

---

<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 17:59 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/7 "2024-06-04T17:59:39Z")

</div>

It was changed...

So most nodes (that have been around for sometime), are not subject to this requirement.  
There is logic in place to lookout for this (previous V new nodes)

 ![Screenshot 2024-06-04 at 18.55.13](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/8/a8a72ee90141ea72761ab409b88266dadbfb99e2.png)

But onto your problem.

I see you are using a docker image for Node RED... so what are you using (HA) ?  
and how are you installing your development Node?

have you changed the name of your node, and installing it ontop of your original name?  
if so, Node RED is letting you know another Node that is using this name (type name) is already installed by another Node.

i.e have you changed to` node-red-contrib-ntc` from another name - without first removing the old named instance (using the same node type name)

The type name is globally unique (across the Node RED estate), technically so is the package name (but that is more an `npm` thing)

---

<div class="post-metadata">

**Author:** ![marknomad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marknomad/32/91701_2.png) [@marknomad](https://discourse.nodered.org/u/marknomad)\
**Post date:** [4 June 2024 18:19 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/8 "2024-06-04T18:19:04Z")

</div>

I haven't changed the name without doing a clean build of the image. This image is for a environment like HA using Docker.

Here's my Dockerfile and main package.json if it helps at all:

> **Dockerfile**
>
> FROM nodered/node-red:3.1.9  
> COPY --chown=node-red:node-red settings.js /data/settings.js  
> COPY --chown=node-red:node-red package.json /data/package.json  
> COPY --chown=node-red:node-red nodes/\* /data/nodes/  
> RUN npm --prefix /data install /data  
> COPY --chown=node-red:node-red config/\* /data/  
> COPY --chown=node-red:node-red subflows/\* /data/subflows/  
> COPY --chown=node-red:node-red flows/\* /data/flows/

> **package.json**
>
> {  
> "name": "ntc-node-red",  
> "description": "",  
> "version": "1.1.0",  
> "private": true,  
> "dependencies": {  
> "uuid": "9.0.0",  
> "mongodb": "5.8.1",  
> "node-red-dashboard": "3.6.2",  
> "node-red-contrib-flow-manager": "0.7.4",  
> "node-red-contrib-heap-dump": "0.0.2",  
> "node-red-contrib-mongodb4": "2.5.2",  
> "node-red-contrib-topic-link": "0.1.0",  
> "node-red-contrib-splitter": "0.0.16",  
> "node-red-contrib-buffer-parser": "3.2.2",  
> "node-red-contrib-delay-topic-message": "1.3.1",  
> "node-red-node-serialport": "2.0.2",  
> "node-red-node-snmp": "2.0.0",  
> "node-red-contrib-modbus": "5.27.2",  
> "node-red-contrib-socketcan": "1.2.9",  
> "node-red-contrib-ntc": "file:nodes"  
> }  
> }

And the project structure:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/f/1f8c6f5778bc4e136c1eca128d891e1f58b7775e.png)

---

<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 18:23 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/9 "2024-06-04T18:23:27Z")

</div>

Ok,

Many here do not use HA, so my guess is there is persistence somewhere,  
Like the `data` folder that lives between images (if I'm not mistaken)

Nodes are not installed into the apps directory, but a user directory, this is your breadcrumb.

Standard Node RED, the user directory is `~/<username>/.node-red`  
but for HA and others alike - they create their own

---

<div class="post-metadata">

**Author:** ![marknomad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marknomad/32/91701_2.png) [@marknomad](https://discourse.nodered.org/u/marknomad)\
**Post date:** [5 June 2024 17:30 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/10 "2024-06-05T17:30:46Z")

</div>

Thanks for your help!

TLDR: moving out of the `/data` directory (e.g. `/nodes` not `/data/nodes`) seems to have fixed the issue.

After debugging this quite a bit more, I was able to figure out that if i removed the `"ntc-test": "ntc-test.js"` entry from my `package.json` the node still remained.

Furthermore, I actually looked at the `node-red` section of my palette and found `ntc-test` listed as if Node-RED registered it (as it said in the logs).

Then by happenstance, I was looking at the name scoping and saw this section which uses a subdirectory for the node:

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

I added a subdirectory and added back the entry to my `package.json`; `"ntc-test": "test/ntc-test.js"`. Following a reinstall and restarting the container, Node-RED no longer had the `ntc-test` node installed, but once I fully rebuilt the container it still showed up.

Finally, I moved the `nodes` directory completely outside of the `/data` directory from `/data/nodes` to `/nodes`. Now when rebuilding the container Node-RED no longer has the node and everything works as expected.

Node-RED must be picking up the `.js` files regardless of depth in the `/data` directory or something along those lines.

---

<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:** [19 June 2024 17:31 UTC](https://discourse.nodered.org/t/name-already-registered-by-module-node-red/88504/11 "2024-06-19T17:31:29Z")

</div>

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