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.
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.
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?
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?
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.
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.
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.
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
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.