Help with deleting and re-installing Node-Red and associated software on Windows 10

Generally, I run node-red on Raspberry Pi but I also have a Win10 based system that I use for general experimentation. I had not used it for a couple of weeks and during that time had a power outage which I suspect corrupted some files because I can no longer get access to my Node-red instance although my PC is running fine..

I keep backups of all my flows so I am happy to do a clean re-install of Node-red.

Before re-installing I would like to start with a clean slate and wondered if anyone could advise on how to clear out the old Node-red and associated files. Any help or suggestions would be appreciated.

I doubt a re-install is necessary.

Just delete (or rename) your existing .node-red userDir.

Assuming a default install, that would be c:\users\YOU\.node-red - rename that to .node-red-old then fire up node-red.

Thanks Steve. I have tried that but got the same error messages as pasted below. I'm afraid I'm not familiar enough with the error messages to make any sense of it.

Your environment has been set up for using Node.js 16.17.1 (x64) and npm.

C:\Users\Michael>Node-red -v
21 Jul 14:35:23 - [info]

Welcome to Node-RED
===================

21 Jul 14:35:23 - [info] Node-RED version: v3.0.2
21 Jul 14:35:23 - [info] Node.js  version: v16.17.1
21 Jul 14:35:23 - [info] Windows_NT 10.0.19045 x64 LE
21 Jul 14:35:23 - [info] Loading palette nodes
21 Jul 14:35:27 - [info] Dashboard version 3.2.3 started at /ui
(node:17264) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red-contrib-rfxcom\node_modules\rfxcom\package.json' of 'rfxcom.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
21 Jul 14:35:27 - [warn] ------------------------------------------------------
21 Jul 14:35:27 - [warn] [node-red-contrib-rfxcom/rfxcom] Error: The module '\\?\C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red-contrib-rfxcom\node_modules\@serialport\bindings\build\Release\bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
21 Jul 14:35:27 - [warn] [node-red-contrib-join/join] 'join' already registered by module node-red
21 Jul 14:35:27 - [warn] [node-red-contrib-node-tradfri/tradfri] Error: Cannot find module 'C:\Users\Michael\node_modules\node-aead-crypto\build\Release\node-v93-win32-x64\node_aead_crypto.node'
Require stack:
- C:\Users\Michael\node_modules\node-aead-crypto\index.js
- C:\Users\Michael\node_modules\node-dtls-client\build\TLS\AEADCipher.js
- C:\Users\Michael\node_modules\node-dtls-client\build\TLS\CipherSuite.js
- C:\Users\Michael\node_modules\node-dtls-client\build\DTLS\Handshake.js
- C:\Users\Michael\node_modules\node-dtls-client\build\dtls.js
- C:\Users\Michael\node_modules\node-coap-client\build\CoapClient.js
- C:\Users\Michael\node_modules\node-red-contrib-node-tradfri\node_modules\node-tradfri-client\build\tradfri-client.js
- C:\Users\Michael\node_modules\node-red-contrib-node-tradfri\node_modules\node-tradfri-client\build\index.js
- C:\Users\Michael\node_modules\node-red-contrib-node-tradfri\dist\node-tradfri.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\lib\red.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\red.js
21 Jul 14:35:27 - [warn] [node-red-contrib-viseo-ffmpeg/ffmpeg-command] Error: Cannot find module 'node-red-viseo-helper'
Require stack:
- C:\Users\Michael\node_modules\node-red-contrib-viseo-ffmpeg\node-ffmpeg-command.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\lib\red.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\red.js
21 Jul 14:35:27 - [warn] [node-red-node-rbe/rbe] 'rbe' already registered by module node-red
21 Jul 14:35:27 - [warn] [node-red-node-serialport/serialport] Error: The module '\\?\C:\Users\Michael\node_modules\node-red-node-serialport\node_modules\@serialport\bindings\build\Release\bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
21 Jul 14:35:27 - [warn] ------------------------------------------------------
21 Jul 14:35:27 - [info] Settings file  : C:\Users\Michael\.node-red\settings.js
21 Jul 14:35:27 - [info] Context store  : 'default' [module=memory]
21 Jul 14:35:27 - [info] User directory : C:\Users\Michael\.node-red
21 Jul 14:35:27 - [warn] Projects disabled : editorTheme.projects.enabled=false
21 Jul 14:35:27 - [info] Flows file     : C:\Users\Michael\.node-red\flows.json
21 Jul 14:35:27 - [info] Creating new flow file
21 Jul 14:35:27 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

21 Jul 14:35:27 - [error] Uncaught Exception:
21 Jul 14:35:27 - [error] Error: listen EADDRINUSE: address already in use 0.0.0.0:1880
    at Server.setupListenHandle [as _listen2] (node:net:1432:16)
    at listenInCluster (node:net:1480:12)
    at doListen (node:net:1629:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

2 clues here.

  1. Seems like you have globally installed node-red-contrib-rfxcom/rfxcom - you need to remove that. Re-installing node-red will NOT solve this.
  2. You have upgraded NodeJS - the error, essentially means, you installed (and it compiled itself) against a different version of nodejs. You can fix that but it is easier/better to do this properly.

npm -g remove node-red-contrib-rfxcom


Also, it looks like there are some other globally installed nodes too.

  • node-red-contrib-viseo-ffmpeg
  • node-red-contrib-join/join
  • node-red-contrib-node-tradfri/tradfri
  • node-red-node-rbe/rbe
  • node-red-node-serialport/serialport

I recommend you remove all of these from the global NPM install.

npm -g remove node-red-contrib-viseo-ffmpeg
npm -g remove node-red-contrib-join/join
npm -g remove node-red-contrib-node-tradfri/tradfri
npm -g remove node-red-node-rbe/rbe
npm -g remove node-red-node-serialport/serialport

If you want them back later, then you should install them through the palette manager OR from inside the .node-red directory (i.e. NOT globally)


once done, Node-RED should start.

PS: Since you are installing nodes that need compilation, I hope you added the build tools when prompted...

image

Appreciate your help Steve. NR still not starting I'm afraid. I did as you suggested and then rebooted the computer.

This is the error message I am now getting.

Your environment has been set up for using Node.js 16.17.1 (x64) and npm.

C:\Users\Michael>node-red
21 Jul 15:29:03 - [info]

Welcome to Node-RED
===================

21 Jul 15:29:03 - [info] Node-RED version: v3.0.2
21 Jul 15:29:03 - [info] Node.js  version: v16.17.1
21 Jul 15:29:03 - [info] Windows_NT 10.0.19045 x64 LE
21 Jul 15:29:04 - [info] Loading palette nodes
21 Jul 15:29:06 - [info] Dashboard version 3.2.3 started at /ui
21 Jul 15:29:06 - [warn] ------------------------------------------------------
21 Jul 15:29:06 - [warn] [node-red-contrib-join/join] 'join' already registered by module node-red
21 Jul 15:29:06 - [warn] [node-red-contrib-node-tradfri/tradfri] Error: Cannot find module 'C:\Users\Michael\node_modules\node-aead-crypto\build\Release\node-v93-win32-x64\node_aead_crypto.node'
Require stack:
- C:\Users\Michael\node_modules\node-aead-crypto\index.js
- C:\Users\Michael\node_modules\node-dtls-client\build\TLS\AEADCipher.js
- C:\Users\Michael\node_modules\node-dtls-client\build\TLS\CipherSuite.js
- C:\Users\Michael\node_modules\node-dtls-client\build\DTLS\Handshake.js
- C:\Users\Michael\node_modules\node-dtls-client\build\dtls.js
- C:\Users\Michael\node_modules\node-coap-client\build\CoapClient.js
- C:\Users\Michael\node_modules\node-red-contrib-node-tradfri\node_modules\node-tradfri-client\build\tradfri-client.js
- C:\Users\Michael\node_modules\node-red-contrib-node-tradfri\node_modules\node-tradfri-client\build\index.js
- C:\Users\Michael\node_modules\node-red-contrib-node-tradfri\dist\node-tradfri.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\lib\red.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\red.js
21 Jul 15:29:06 - [warn] [node-red-contrib-rfxcom/rfxcom] Error: The module '\\?\C:\Users\Michael\node_modules\@serialport\bindings\build\Release\bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
21 Jul 15:29:06 - [warn] [node-red-contrib-viseo-ffmpeg/ffmpeg-command] Error: Cannot find module 'node-red-viseo-helper'
Require stack:
- C:\Users\Michael\node_modules\node-red-contrib-viseo-ffmpeg\node-ffmpeg-command.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\index.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\lib\red.js
- C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\red.js
21 Jul 15:29:06 - [warn] [node-red-node-rbe/rbe] 'rbe' already registered by module node-red
21 Jul 15:29:06 - [warn] [node-red-node-serialport/serialport] Error: The module '\\?\C:\Users\Michael\node_modules\node-red-node-serialport\node_modules\@serialport\bindings\build\Release\bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
21 Jul 15:29:06 - [warn] ------------------------------------------------------
21 Jul 15:29:06 - [info] Settings file  : C:\Users\Michael\.node-red\settings.js
21 Jul 15:29:06 - [info] Context store  : 'default' [module=memory]
21 Jul 15:29:06 - [info] User directory : \Users\Michael\.node-red
21 Jul 15:29:06 - [warn] Projects disabled : editorTheme.projects.enabled=false
21 Jul 15:29:06 - [info] Flows file     : \Users\Michael\.node-red\flows.json
(node:8776) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\Michael\node_modules\rfxcom\package.json' of 'rfxcom.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
21 Jul 15:29:06 - [info] Creating new flow file
21 Jul 15:29:06 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

21 Jul 15:29:06 - [error] Uncaught Exception:
21 Jul 15:29:06 - [error] Error: listen EADDRINUSE: address already in use 0.0.0.0:1880
    at Server.setupListenHandle [as _listen2] (node:net:1432:16)
    at listenInCluster (node:net:1480:12)
    at doListen (node:net:1629:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

That means that node-red is already running. Presumably you have set it up to run automatically on reboot. You must stop it before starting it again.

"Presumably you have set it up to run automatically on reboot."

That is the case Colin. stupid question but how do I stop Node-red? I just tried to google it but found nothing instructive.

No idea (I don't use windows). It will depend on how you have set it up to autorun.
This isn't the cause of the earlier problems of course.

You should not have a folder C:/Users/Michael/node_modules. Presumably at some point you installed some nodes manually from from Michael, instead of Michael/.node-red. Rename that node_modules folder to something different and try again.

Thanks Colin (and Steve). I seem to have Node-red back but without my old flows. Not a problem as I have them all backed up.

Two strange things, first is that I used to access Node-red via my PCs fixed network address followed by the port. Now I can only access it via local host 0.0.0.0:1880.

The second thing is that I do need the folder C:/Users/Michael/node_modules. If I rename it, Node-red starts to load but then stops. I suspect this has something to do with my very first attempts some years ago to get Node-red running on my PC. In fact, during those early attempts I lost my Node-red and you (Colin) helped me get it back.

Anyway, it's working again so thank you both for your considerable help. As always, very much appreciated. :grin: :+1:

Show us the startup log for that case. You should not have that folder, so you need to get it working without.

You should be able to access as http://localhost:1880. You shouldn't use your PC's fixed address if the browser is on the same PC since that would force network traffic onto your LAN and back (tromboning).

In that case, you do need to remove the node-red installation along with the other global installs, then get rid of that folder and do a standard install of node-red from a standard command prompt (not an admin elevated prompt). npm install -g node-red --unsafe-perm is the command to use.

Don't leave it as it is, even if it appears to be working, because it will cause you issues in the future.

It seems you have run NPM install in the wrong directory at some point. You should delete this folder the packaging.json file in C:/Users/Michael then your troubles will be over.

Thanks for the feedback, your advice seems to suggest I go back to a clean install which I am happy to do. In this case how would I ensure a clean uninstall of Node-red from my PC? I can find plenty of examples of how to install Node-red but nothing on how to uninstall it.

Try my and Steve's suggestion first please.
Remove the node_modules folder I suggested, and also, if present, C:/Users/Michael/package.json and package-lock.json and restart node-red. If it doesn't run then post the startup log.

All you should need to do is this, from a command line:

npm -g remove node-red

You can do the other uninstalls at the same time. Then remove the errant node_modules folder and rename the .node-red folder. Then you should be able to start again from scratch. But you will still have a copy of your existing flows in case you need to restore or otherwise reference them.

Colin, Steve.

I have done as suggested and now my Node-red is opening as expected and VERY much faster than previously.

Now, I wonder if my flows are floating around in a "wrong" folder.

Many thanks for everyones help.

Thanks @TotallyInformation, I confess I have never heard of tromboning. The reason I have been using the fixed IP address to address my Node-red installations is that I have several headless Raspberry Pi's running Node-red each set up for different functions as part of my distributed network. I have a central Pi with a monitor that I use as a master to edit and manage my other Pi's. Probably doing it all wrong but I don't like the idea that if one Pi goes down I lose all my system. Any suggestions on a better way of addressing my Node-red instances would be welcomed.

The PC I have been referring to is part of the same network but I use it to play with ideas I have before rolling out the flows to the Pi's. Hope this makes some kind of sense. Anyway, thanks for your suggestions.

All makes sense. And nothing wrong with the approach. It is only that you don't really want traffic headed out of your PC only to have to come back in again and then do the same in the opposite direction simply to get back to your browser.

If you picture a trombone being played, you will probably get the idea.

Tromboning traffic flow:

browser (PC) -> router -> Node-RED (PC) -+
                                         |
                                     <---+

You only need a local traffic flow if node-red and the browser are on the same pc.

browser -> node-red -+
                     |
                 <---+