Hey,
I am on Windows 10 and tried to upgrade Node-RED. First, I have upgraded NodeJS (v12.13.0), NPM (6.12.0) and then executed npm install -g --unsafe-perm node-red
The message:
C:\Users\xxxx\AppData\Roaming\npm\node-red -> C:\Users\xxxx\AppData\Roaming\npm\node_modules\node-red\red.js
C:\Users\xxxx\AppData\Roaming\npm\node-red-pi -> C:\Users\xxxx\AppData\Roaming\npm\node_modules\node-red\bin\node-red-pi
node-red@1.0.2
updated 1 package in 11.064s
was displayed.
If I run node-red, the old version is still there:
Welcome to Node-RED
===================
29 Oct 11:08:19 - [info] Node-RED version: v0.20.5
29 Oct 11:08:19 - [info] Node.js version: v12.13.0
29 Oct 11:08:19 - [info] Windows_NT 10.0.18362 x64 LE
29 Oct 11:08:20 - [info] Loading palette nodes
29 Oct 11:08:20 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
29 Oct 11:08:20 - [info] Dashboard version 2.17.1 started at /ui
You have to check your path environment to see which node-red executable it is picking up and then see why it isn't picking up wherever the upgraded node-red has been put.
v1.0.2 -> C:\Users\stamer\AppData\Roaming\npm\node_modules\node-red
If I launch node-red (I'm in c:\users\stamer.node-red) it will run the old version.
What is the correct path for node-red?
Please help!
Many thanks.
Thanks for your answer.
I use at the moment node-red v.0.20.5.
v1.0.2 includes some changes, especially regarding the new signature for the input event callback function. I wanted to update my custom nodes to this new callback signature...
Maybe someone else can tell me the node-red path...
To find the actual command on Windows, it is similar to the way you do it on Linux. The only thing is that you need to use PowerShell and not a cmd prompt.
Hey Julian,
thanks for reply.
If I use PowerShell, I got the same path as the cmd prompt: /cygdrive/c/Program Files/nodejs/node-red.
I expected this, because the old version will be launch from there.
But I'm surprised to see, that only the path of the current version v1.0.2 is in my path environment and nevertheless the old version will be launch...
The path shows me that you are using cygwin rather than native Windows - the reason you have 2 installations is because you've installed it twice I suspect, each time a different way.
Node-RED and node.js works very well, of course, natively in Windows and there is no need for cygwin. If you really want a Linux-like environment in Windows, I would suggest using the Windows Subsystem for Linux (WSL) which is much better integrated than the rather long in the tooth cygwin.
Incidentally, if you find yourself needing more complex development scenarios with Node-RED, I suggest installing it locally rather than globally which can help avoid all of these issues. I wrote the alternate installer listed previously to help with that. You can find it in my GitHub.
Thank you Julian.
You comes from IT sector.
Please, can you tell me, if it is a best practice to remove the directory where the old version of node-red resides and to install the new one to that path?
Many thanks.
I think what Julian is trying to say is that you have installed two different TYPES of Node-red - one of them is a Native Windows installation executable and the other appears to be the linux one, which you have kludged by using Cygwin - so first question - is there a reason for this or have you just been "stumbling around",
What is your preferred operating environment - if it is Windows then remove cygwin and NR from there and do a native windows install to upgrade your current version
If you want to operate in a linux environment then either install and setup WSL (As Julian has said above) or spin up a Linux Virtual machine under Hyper V (free with Windows 10) and install NR in there
Well, I've been at it since about 1978 so I should have picked up a thing or two by now I guess!
Well, as Craig says, unless you have a good reason to keep another version, personally I would get rid of it since it will get stale and probably cause you future confusion.
The reason I always install locally is so that I'm always in control of where things are and I can always see where things are since everything is contained by a single parent folder. I always then create my userDir as a subfolder and everything stays together. Easy to remember, easy to manage, easy to back up or move.
In regard to cygwin, I think that most people end up with it because of Git. Traditionally, git needed a number of Linux type command line tools to work properly and the easiest way for them to do that on Windows was with cygwin.
So you probably just need to make sure that you are NOT using the git shell but instead either use the Windows cmd.exe shell or PowerShell. Then you can install npm packages in a consistent way. If you've installed git from the official Windows installation, it should work just fine under Windows' shells.
which node-red tells you which version your current shell is trying to use. npm -g remove node-red gets rid of it.
I used Cygwin a long time ago, my system is old... @craigcurtin There was no reason to install node-red there. @cymplecy .node-red.cmd does not work.
I will remove Cygwin, then node-red and then I will reinstall node-red to have only the latest version. @TotallyInformation I will try the alternate-node-red-installer.