Node-Red Installation Issue

I currently have Node-Red running on 2 PC's one version I access via the localhost, the other I access over the local network.

The localhost Dashboard version does not respond to Right-Mouse clicks (no popup window), the network Dashboard does respond to Right-Mouse clicks opening the popup window for editing.
The localhost Dashboard version is v2.1.3, the network Dashboard version is v3.0.2.

Both PC's have an Admin account, and a Standard account; for both PC's the npm folder is in the Admin account (Roaming folder), and the .Node-Red folder is in the Standard account (where I do most of my work).

As a quick test, and after renaming the npm folder on the localhost PC, I copied the npm folder from the network PC to the localhost PC; it did not make any difference to the Dashboard version, or the Right-Mouse key function.

I wanted to run "npm rebuild"; the documentation refers to running it in the proper folder and references the Node-Red folder (~/.node-red); but, it also says to check where the installation is located (npm list -g --depth 0). That returns the Admin Roaming "npm" folder and node-red@3.0.2, npm@9.6.0. These versions are clearly because I copied the network PC folder to the localhost PC, but again the version is not reflected in the Dashboard and the Right-Mouse key does not bring up the popup editing window..

Should I try running "npm rebuild" at the Admin Roaming folder location of the "npm" folder on the localhost (not sure why the documentation refers to the "~/.node-red" folder)? My objective is to get the Right-Mouse function working on the localhost PC.

Thanks, X.

What OS are you running?

What do you mean by the npm folder?

If you need to run npm rebuild then you should do it from the .node-red folder.

When you say dashboard do you mean the node-red editing window or the node-red-dashboard display. What version do you expect to see there and where are you looking?

You do not need to run npm rebuild unless you have updated nodejs. If you do run it then do it from the .node-red folder, where the flows file is located.

Hi Colin,

  • OS Is Windows 10
  • Path to npm: C:\Users\Lock (admin)\AppData\Roaming\npm
  • Standard Account Node-Red path: C:\Users\Lock.node-red (where I do most of my work)
  • But there is also an Admin Node-Red folder: C:\Users\Lock (admin).node-red (I have some test flows there, but it's not where I do most of my work)
  • Dashboard version at the bottom:

If npm rebuild should be run from the flows folder (.Node-Red) should I do it to both the Admin location and the standard location. Also why does the documentation say run npm list -g --depth 0 to find the folder when it only finds the npm folder?

X.

That is not the dashboard version, that is the node-red version.

Why do you want to run npm rebuild?
If you do need to run it then do it from both.

What documentation?

If you are trying to upgrade node-red to the latest version, then what you need to do depends on how you installed node-red initially.

As for the right click not working, what browser are you using and can you try a different browser?

Documentation that refers to npm rebuild: Supported Node versions : Node-RED

I'm using the same browser for the both PC's the localhost PC and the network PC: the version of Node-Red on the network PC is v3.0.2 and the Right-Mouse popup works, the localhost PC Node-Red version is v2.1.3 and the Right-Click Popup window does not function.

Given that as I'm using the same browser for both, it's not the browser; my working hypothesis is that it's the older version of Node-Red on the localhost PC that's causing the issue.

Will running npm rebuild upgrade to the latest Node-Red version; in fact what is the latest version?

X.

OK, perhaps you should do that if you have upgraded nodejs. Have you upgraded nodejs?
What does npm list -g --depth 0 show?

It displays this path: C:\Users\Lock (admin)\AppData\Roaming\npm
and node-red@3.0.2, npm@9.6.0.

I have not performed any npm upgrade.
However, remember I simply copied the npm folder from the network PC to the localhost PC so it's reflecting the versions that are on the network PC. Not sure if that qualifies as a true Node.js upgrade. The server seems to run normally, but Node-Red is still the old version and the Right-Mouse key still does not function. NOTE: I saved the original localhost npm folder, in case I needed to restore it.

npm and nodejs are separate applications. npm is normally installed as part of the nodejs installation.

It is a bad idea to try and manipulate folders relating to npm manually. I suggest restoring the original folder, rebooting, and then upgrading node-red by re-installing it using the command
npm install -g --unsafe-perm node-red
Then restart nodered.

Note that you need at least nodejs version 14 installed (preferably version 18). You can check that using
node -v

I must admit, while I have quite extensive knowledge of Windows PC's, using Win32 and various installations; but I still have not wrapped my head around the Node-Red structure. It's a difference animal altogether; so you'll need to excuse my ignorance.

I assume I should run "npm install -g --unsafe-perm node-red" at both Node-Red folders (Admin & Standard)?

I see that Node.js 20.9.0 is the lastest recommended: Node.js; and I should do that installation before "npm install -g --unsafe-perm node-red"?

No, the -g means global. There is only one installed version of node red when installed this way. Just the same as you only have one installed version of MS Word, but can have documents in many folders, so you can have flows setup in multiple folders.

I see that Node.js 20.9.0 is the lastest recommended: Node.js; and I should do that installation before "npm install -g --unsafe-perm node-red"?

node -v = v14.18.1

Yes. Do that as described in the node red docs, running on Windows. Make sure the box to install the build tools is checked when you get to that point in the nodejs install.

In that case it is not essential to upgrade nodejs, but I suggest you do anyway as 14 is out of support.

I'll restore the original npm folder, restart and then do the Node.js installation.

Then I'll ask you for the relationship between: Node.js, npm & Node-Red :wink:

Hi Colin,

Looks like everything worked I now have Node-Red v3.1.0 & I have the context menus.

Thanks for the help.

Now just what is the relationship between Node.js, npm and Node-Red?

Simplifying, nodejs is an application that interprets and runs javascript.

Node-red is a set of javascript packages that are interpreted and run by nodejs. When you run node-red you are actually starting nodejs, pointing to node-red, which itself interprets your flow.

npm is a tool that is used for installing javascript packages such as node-red and contributed nodes.

Got it, thanks.
BTW: While Java-Script is certainly preferred for web applications, my personal preference is Python. One of the frustrating aspects of Java-Script is that it launches multiple instances of a function. For example it I use setInterval, or setTimeout thinking I can run one followed by a second in a Function Node. Rather than a sequential flow, two instances are launched and they are executed simultaneously. There is no function that can be used to execute a sequence of operations in order in a Function-Node; at least that I know about

I have found a link to install a Python based Function-Node; node-red-contrib-python-function (node) - Node-RED.
Do you have any familiarity with this node?

X.

That is only true for asynchronous operations. setInterval() and setTimeout() each start an asynchronous operation. In your example, setInterval() and setTimeout() are, in fact, called sequentially. It is the asynchronous operations that carry on in parallel.

Indeed that is possible, but it is quite complex. Research asynchronous functions in javascript if you want to find how to do it, look for await. However, this is rarely necessary in node-red. Often, if you find yourself using asynchronous functions, such as setInterval, it means that there are better ways to solve the problem using the low-code features of node-red. Tell us more about the requirement where you find yourself doing this.

The only experience that I have of this is seeing users trying to use the node and asking for help here due to problems with the node. if you have existing code in python that you must use in node-red the easiest way is to use an exec node to execute the python outside the node-red environment.

Actually, I use the exec node extensively; what I wanted was to execute certain functions sequentially within a function-node; a function-node using python would allow sequential operations.

It's not really a deal breaker; as there are conventional nodes I could use, it just might be a bit cleaner with a python function-node.

I find Node-Red an amazing technology, especially when combined with MQTT. It's amazing that IBM developed both in the 1990's and they're gaining new popularity now.

Thanks again for all your help, and patience :slightly_smiling_face:

X.