I have Node Red running as a service on a Windows 10 PC. When I access it via a browser I see from the menu it is still showing 1.3.1. I have restarted the PC.
I have made some progress but still have an issue to resolve so help appreciated
I have been running node-red as a service. If I run the service it starts node-red with c:\Users\Ian\AppData\Roaming\npm\node-red.cmd and I see version 1.3.1.
If I run node-red from the command line with C:>node-red, I get 1.3.4!
It seems something has changed since I last did an update, but what?
That is likely to be a PATH issue. When running as a service, you will normally be running as a special system account whereas running from the command line, you are running as the logged in user.
These have different environment variables. If you start a PowerShell terminal (not cmd prompt), you can use the where
command to find out what is servicing a particular command. That will let you see where you've installed Node-RED.
I suspect that you have originally installed it globally but then installed 1.3.4 locally.
Thank you for getting back to me. I am a novice here so will need a bit of help.
I did the original install as per the instructions on Node-Red. I have updated a couple of times previously using 'npm install -g --unsafe-perm node-red' in a CMD box. It is only with 1.3.4 I am seeing this issue.
Could you give me a bit more insight into how I should use the where command in PowerShell?
Cheers
OK, try these commands instead:
This lists every npm package you have installed globally along with the current version
npm -g ls --depth=0
This lists what you have installed in your local c: drive root:
cd c:\
npm ls --depth=0
If that doesn't help, from a cmd prompt, type path
or from PowerShell, $env:path
- or for an easier read: ($env:path).split(";")
(powershell only). That tells you (in reverse order) all of the folders that windows will look at to find commands.
Thank you.
As soon as I get a chance I'll see what I can work out.
C:>npm -g ls --depth=0
C:\Program Files\nodejs
+-- node-red@1.3.4
`-- npm@7.11.2
and
C:>path
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\nodejs;C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\Ian\AppData\Local\Programs\Python\Python38-32;C:\Users\Ian\AppData\Local\Microsoft\WindowsApps;C:\Users\Ian\AppData\Roaming\npm
I can't see from this how I can run 2 versions of Node_red!
When I issue that command, I get:
C:\src
> npm -g ls --depth=0
C:\Users\<...userName...>\AppData\Roaming\npm
...
I think that what has happened is that you installed Node-RED globally using an elevated command prompt. That has resulted in Node-RED being installed to C:\Program Files\nodejs
.
Not sure if this is now an issue with npm or with the Node-RED install I'm afraid.
Ah, actually, did you install an update to nodejs for ALL USERS? But originally just for the current user? That might be why npm is using the programme files folder. That would mean that you would have to do global installs from an elevated command prompt. So you have two different copies of Node-RED installed in two different places.
You may need to uninstall nodejs completely, remove the folders C:\Program Files\nodejs
and C:\Users\Ian\AppData\Roaming\npm
and remove C:\Users\Ian\AppData\Roaming\npm
from your path. Reboot and then reinstall nodejs. When you install nodejs, make sure you install only for the current user. That way, you can still install even global installs using a standard command prompt.
You may well be right! Whatever has happened I simply follow the guidance for whatever update is offered.
If I remove and then re-install nodejs as suggested, will that affect my Node-red setup? I would hate to have to recreate all the flows again!!
What guidance from where?
It should not, but you should already have your flows backed up, just as you backup other files on your computer. A hard disk or PC can go up in flames at any time (literally or metaphorically) so you must make sure you have always have backups of important stuff. For node-red, backup everything in your .node-red folder except the node_modules folder which is very large and easily rebuilt.
Further progress, but not there yet.
I uninstalled node.js and reinstalled. It was in C:\Program Files\nodejs and re-installed to the same place.
That resulted in only node-red 1.3.1 starting up at the command prompt.
Clearly 1.3.4 was not installing in the same place.
My attention is needed elsewhere so I will leave it for the minute and come back when I can.
In the meantime I restored everything from my backup.
Did you remove all the folders suggested?
Exactly how did you install nodejs and node-red this time?
Thank you for your input. I now seem to have only one version of Node-red and it runs as a service as it should do.
One thing that surprised me was despite deleting the relevant directories when I reinstalled node.js and node-red all my flows were still there.
Your flows files are in your .node-red directory. Nothing you did would affect the flows files any more than removing and reinstalling MS Word, for example, would delete all your word documents..
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.