Confused about potential naming conflicts between module names, node names, and palette or flow management

Suppose I install a module node-red-contrib-foo, which adds a node bar to the palette. Then I install a second module @me/node-red-special, which also defines a node bar added to the palette.

How does node-red resolve this, as information about the node origin (i.e. module) doesn’t seem to appear in the flows.json file? I can see how namespaces prevent module conflicts, but how does someone creating a node prevent naming conflicts with nodes of other modules?

Most of the node names I observe seem simple and likely to conflict at some point. For example, given the following code, how would I be certain that I am acting on my ‘bar’ node and not a different ‘bar’ node?

  If (n.type===‘bar’) {
    // do something wrt my ‘bar’ node here…

Is there a naming convention for node names that prevents this?

It "resolves" it by throwing out the second node and giving you an error in the log. You cannot have 2 nodes with the same name.

Mostly, the "simple" names come from core nodes developed by the Node-RED devs. A sensible contributor creating a node needs to choose a name carefully and not block out someone else.

Of course, this is all open source. So anyone can do what they like, but if they annoy users, people will simply delete their nodes :grin:

1 Like

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