Update NodeRED to 4.0.5 from 3.0.2 failing

Hi,
I just want to update NodeRED to 4.0.5 from 3.0.2, so I launch the script on the official site but something was wrong.

The script has updated Node from 16.x to 18.14.1 but hasn't update NodeRED and also now I can't run node-red-start because NodeRED try to start using node v12.22.12 and I don't know how to fix it!

[UPDATE]:
using node-red --version the correct version ov Node.js is selected and NodeRed start correctly, but with the old version.

Can someone help me!
Alan

Which operating system and hardware are you using??

Hi Paul and thanks for the reply,
Im using nodered from Raspberry Pi 4 that's run Raspbian 11 (bullseye)

Alan

I think you have nvm or n or some other node version manager installed. Uninstall that and all should be good (search internet for how to do that)

Thank you Steve,

So I need to uninstall n or nvm or NodeRED?

Alan

Yes, if you have them installed, and also you may need to delete local folders that they use. Work out what you have installed and then google for how to completely remove it.

Hi,
I don't know if it's true but seems that I not have installed either n or nvm:
image

Alan

What do the commands node -v and which node show?

Perhaps you have volta or fnm or asdf node version manager instead?

The reason I suspect you have a node version manager is your installation says Nord 18 was installed, but when you run node-red it reports version 12. This is very typical of a node version manager.

Hi Colin,

you're right:

So, I'm not an expert of Linux OS so basically I don't know how to uninstall those softwares, if there is some correct procedure can you suggest a guide/tutorial/article for doing it in the correct way?

Alan

image

At some stage you have used nvm. Delete the .nvm folder and try those commands again.
[Edit] Then run the node red upgrade script again to correctly install a later version of nodejs.

Hi Colin,
Node-RED is sucesfully installed, but it isn't able to start yet:

It looks like serialport didn't install properly.
More information can be found here https://serialport.io/docs/guide-installation
The result of requiring the package is: undefined
Error: Could not locate the bindings file. Tried:
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/build/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/build/Debug/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/build/Release/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/out/Debug/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/Debug/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/out/Release/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/Release/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/build/default/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/compiled/20.18.1/linux/arm/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/addon-build/release/install-root/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/addon-build/debug/install-root/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/addon-build/default/install-root/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/lib/binding/node-v115-linux-arm/bindings.node
    at bindings (/home/pi/.node-red/node_modules/@serialport/bindings/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/home/pi/.node-red/node_modules/@serialport/bindings/lib/linux.js:2:36)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/pi/.node-red/node_modules/@serialport/bindings/lib/index.js:14:22)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/pi/.node-red/node_modules/serialport/lib/index.js:2:17)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/pi/.node-red/node_modules/firmata/lib/com.js:44:18)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/pi/.node-red/node_modules/firmata/lib/firmata.js:3:40)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at module.exports (/home/pi/.node-red/node_modules/node-red-node-arduino/35-arduino.js:5:17)
    at loadNodeSet (/usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js:359:27)
    at /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js:453:31
    at Array.forEach (<anonymous>)
    at loadNodeSetList (/usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js:448:11)
    at /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js:145:16 {
  tries: [
    '/home/pi/.node-red/node_modules/@serialport/bindings/build/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/build/Debug/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/build/Release/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/out/Debug/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/Debug/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/out/Release/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/Release/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/build/default/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/compiled/20.18.1/linux/arm/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/addon-build/release/install-root/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/addon-build/debug/install-root/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/addon-build/default/install-root/bindings.node',
    '/home/pi/.node-red/node_modules/@serialport/bindings/lib/binding/node-v115-linux-arm/bindings.node'
  ]
}
17 Dec 11:09:51 - [warn] ------------------------------------------------------
17 Dec 11:09:51 - [warn] [node-red-node-arduino/arduino] Missing serialport dependency
17 Dec 11:09:51 - [warn] [node-red-node-pi-sense-hat/sensehat] Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat
17 Dec 11:09:51 - [warn] [node-red-contrib-gpio/gpio] Error: Could not locate the bindings file. Tried:
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/build/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/build/Debug/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/build/Release/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/out/Debug/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/Debug/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/out/Release/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/Release/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/build/default/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/compiled/20.18.1/linux/arm/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/addon-build/release/install-root/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/addon-build/debug/install-root/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/addon-build/default/install-root/bindings.node
 โ†’ /home/pi/.node-red/node_modules/@serialport/bindings/lib/binding/node-v115-linux-arm/bindings.node
17 Dec 11:09:51 - [warn] ------------------------------------------------------
17 Dec 11:09:51 - [info] Settings file  : /home/pi/.node-red/settings.js
17 Dec 11:09:51 - [info] Context store  : 'default' [module=memory]
17 Dec 11:09:51 - [info] User directory : /home/pi/.node-red
17 Dec 11:09:51 - [info] Projects directory: /home/pi/.node-red/projects
17 Dec 11:09:51 - [warn] httpsRefreshInterval requires https property to be a function
17 Dec 11:09:51 - [red] Uncaught Exception:
17 Dec 11:09:51 - [error] Error: listen EADDRINUSE: address already in use 0.0.0.0:1880
    at Server.setupListenHandle [as _listen2] (node:net:1908:16)
    at listenInCluster (node:net:1965:12)
    at doListen (node:net:2139:7)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Consumed 9.799s CPU time.

[hint]:
is possible that is the MariaDB configuration that can have conflicts on it?

edit:
The UI dashboard is up and running, but the node-red console isn't able to load on the browser!

Alan

That means that probably node red was already running when you started it again. Stop node-red using
node-red-stop
then start it again using
node-red-start
If you still have problems then post the full output from node-red-start

Already done but the same result is shown

Alan

So after running node-red-stop you still see the EADDRINUSE error? If so then run node-red-stop again then post the result of
ps -aux |grep -i node
and
top

If you are not seeing the EADDRINUSE error then please do as I asked and post the output from
node-red-start after running node-red-stop.

Hi Colin,

pi        1989  0.2  2.4 224456 95536 ?        Sl   dic16   4:21 /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/node /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/out/server-main.js --connection-token=remotessh --accept-server-license-terms --start-server --enable-remote-auto-shutdown --socket-path=/tmp/code-d56fd031-f94d-40ba-b4f4-a34e20a0e6a7
pi        2373  0.2  1.2 206352 48512 ?        Sl   dic16   4:49 /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/node /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/out/bootstrap-fork --type=ptyHost --logsPath /home/pi/.vscode-server/data/logs/20241216T093242
pi        4695  1.0 12.9 1727056 503876 ?      Sl   dic16  19:29 /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/node --dns-result-order=ipv4first /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/out/bootstrap-fork --type=extensionHost --transformURIs --useHostProxy=false
pi        4702  0.0  1.0 180788 40884 ?        Sl   dic16   0:14 /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/node /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/out/bootstrap-fork --type=fileWatcher
pi        8327  0.0  2.1 1266308 84412 ?       Sl   dic16   0:11 /home/pi/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/node /home/pi/.vscode-server/extensions/visualstudioexptteam.intellicode-api-usage-examples-0.2.8/dist/server/server.js --node-ipc --clientProcessId=4695
pi        9217  0.0  0.0   7760  2740 pts/1    T    11:06   0:00 /bin/bash /usr/bin/node-red-log
root      9221  0.0  0.1  13104  4396 pts/1    T    11:06   0:00 sudo journalctl -f -n 25 -u nodered -o cat
root      9222  0.0  0.6 548228 25432 pts/1    T    11:06   0:00 journalctl -f -n 25 -u nodered -o cat
pi       10177  0.0  0.0   7760  2928 pts/1    T    11:09   0:00 /bin/bash /usr/bin/node-red-start
root     10188  0.0  0.1  13104  4352 pts/1    T    11:09   0:00 sudo systemctl start nodered
root     10189  0.0  0.0  11140  1092 pts/1    T    11:09   0:00 systemctl start nodered
pi       10237  0.0  0.0   7760  2928 pts/1    T    11:09   0:00 /bin/bash /usr/bin/node-red-start
root     10255  0.0  0.1  13104  4288 pts/1    T    11:09   0:00 sudo journalctl -f -n 0 -u nodered -o cat
root     10257  0.0  0.6 549812 25080 pts/1    T    11:09   0:00 journalctl -f -n 0 -u nodered -o cat
pi       10557 38.4  5.7 333832 223236 pts/0   Sl+  dic15 920:12 node-red
pi       10656  0.0  0.0   7760  2832 pts/0    S+   dic15   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 26 0
pi       10659  0.0  0.2  15324  8144 pts/0    S+   dic15   0:05 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 26 0
pi       10660  0.0  0.0   7760  2724 pts/0    S+   dic15   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 19 0
pi       10662  0.0  0.2  15324  8208 pts/0    S+   dic15   0:37 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 19 0
pi       10663  0.0  0.0   7760  2780 pts/0    S+   dic15   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 13 0
pi       10665  0.0  0.0   7760  2712 pts/0    S+   dic15   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 6 0
pi       10666  0.0  0.2  15324  8140 pts/0    S+   dic15   0:23 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 13 0
pi       10668  0.0  0.2  15324  8196 pts/0    S+   dic15   0:24 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 6 0
pi       11720  0.0  0.0   7760  2928 pts/1    T    11:14   0:00 /bin/bash /usr/bin/node-red-start
root     11734  0.0  0.1  13104  4276 pts/1    T    11:14   0:00 sudo journalctl -f -n 0 -u nodered -o cat
root     11735  0.0  0.6 549812 25440 pts/1    T    11:14   0:00 journalctl -f -n 0 -u nodered -o cat
pi       13319  0.0  0.0   7760  2956 pts/1    T    11:18   0:00 /bin/bash /usr/bin/node-red-start
root     13336  0.0  0.1  13104  4288 pts/1    T    11:18   0:00 sudo journalctl -f -n 0 -u nodered -o cat
root     13339  0.0  0.6 549812 24156 pts/1    T    11:18   0:00 journalctl -f -n 0 -u nodered -o cat
pi       14142  0.0  0.0   7760  2964 pts/1    T    11:21   0:00 /bin/bash /usr/bin/node-red-start
root     14213  0.0  0.1  13104  4212 pts/1    T    11:21   0:00 sudo journalctl -f -n 0 -u nodered -o cat
root     14217  0.0  0.6 549812 24056 pts/1    T    11:21   0:00 journalctl -f -n 0 -u nodered -o cat
pi       26928  0.0  0.0   7460   568 pts/1    S+   15:38   0:00 grep --color=auto -i node
top - 15:50:52 up 121 days, 23:42,  3 users,  load average: 0,44, 0,48, 0,78
Tasks: 267 total,   2 running, 245 sleeping,  20 stopped,   0 zombie
%Cpu(s): 18,9 us, 17,6 sy,  0,0 ni, 63,5 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
MiB Mem :   3794,3 total,    343,2 free,   1708,3 used,   1742,8 buff/cache
MiB Swap:    100,0 total,      0,1 free,     99,9 used.   1902,4 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
10557 pi        20   0  334856 224972  39792 S  70,6   5,8 924:52.79 node-red
  211 root      20   0       0      0      0 R  58,8   0,0  14181:09 w1_bus_master1
29584 pi        20   0   11480   3200   2624 R  11,8   0,1   0:00.04 top
    1 root      20   0   41368  13384   5180 S   0,0   0,3   5:02.11 systemd
    2 root      20   0       0      0      0 S   0,0   0,0   0:22.31 kthreadd
    3 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_gp
    4 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_par_gp
    5 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 slub_flushwq
    6 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 netns
   10 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 mm_percpu_wq
   11 root      20   0       0      0      0 I   0,0   0,0   0:00.00 rcu_tasks_kthread
   12 root      20   0       0      0      0 I   0,0   0,0   0:00.00 rcu_tasks_rude_kthread
   13 root      20   0       0      0      0 I   0,0   0,0   0:00.00 rcu_tasks_trace_kthread
   14 root      20   0       0      0      0 S   0,0   0,0   6:30.62 ksoftirqd/0
   15 root      20   0       0      0      0 I   0,0   0,0 201:09.63 rcu_preempt
   16 root      rt   0       0      0      0 S   0,0   0,0   0:05.52 migration/0
   17 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/0
   18 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/1
   19 root      rt   0       0      0      0 S   0,0   0,0   0:04.77 migration/1
   20 root      20   0       0      0      0 S   0,0   0,0   3:43.81 ksoftirqd/1
   23 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/2
   24 root      rt   0       0      0      0 S   0,0   0,0   0:05.07 migration/2
   25 root      20   0       0      0      0 S   0,0   0,0   3:06.79 ksoftirqd/2
   28 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/3
   29 root      rt   0       0      0      0 S   0,0   0,0   0:05.46 migration/3
   30 root      20   0       0      0      0 S   0,0   0,0   2:58.09 ksoftirqd/3
   33 root      20   0       0      0      0 S   0,0   0,0   0:00.01 kdevtmpfs
   34 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 inet_frag_wq
   36 root      20   0       0      0      0 S   0,0   0,0   0:00.00 kauditd
   38 root      20   0       0      0      0 S   0,0   0,0   0:09.27 khungtaskd
   40 root      20   0       0      0      0 S   0,0   0,0   0:00.00 oom_reaper
   41 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 writeback
   42 root      20   0       0      0      0 S   0,0   0,0  44:43.89 kcompactd0
   43 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kintegrityd
   44 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kblockd
   45 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 blkcg_punt_bio
   46 root     -51   0       0      0      0 S   0,0   0,0   0:00.00 watchdogd
   50 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rpciod
   51 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 xprtiod
   55 root      20   0       0      0      0 S   0,0   0,0   1:12.54 kswapd0
   56 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 nfsiod
   57 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kthrotld
   66 root      20   0       0      0      0 S   0,0   0,0   0:05.96 hwrng
   67 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 iscsi_conn_clea
   68 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 nvme-wq
   69 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 nvme-reset-wq
   70 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 nvme-delete-wq
   72 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 DWC Notificatio
   73 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 uas
   74 root       1 -19       0      0      0 S   0,0   0,0  11:40.49 vchiq-slot/0
   75 root       1 -19       0      0      0 S   0,0   0,0   0:16.95 vchiq-recy/0
   76 root       0 -20       0      0      0 S   0,0   0,0   0:00.00 vchiq-sync/0
   77 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 zswap-shrink
   99 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 sdhci

Basically the 10557 process was using the same address... I killed it and all it's working now!

Thanks

1 Like

If you do sudo systemctl disable nodered * and reboot, what does ps -ef | grep node-red | grep -v grep show you?
Assuming it returns nothing, does node-red-start work?

* to make node-red start automatically [again] you would eventually need to run sudo systemctl enable nodered

Basically I think that the "node-red" service was activated by my call to node-red --version, so for now all it's ok... mabye when I have a moment (My nodered is going to menage many thinks so I can't just turn it off when I want) I can try to reboot RPI and see if all it's ok!

Alan

As you can see from the top output, node-red is hogging the processor, so something is wrong. The way to get round that is to do what @jbudd suggested, disabling the node red start on boot, then boot and run
node-red --safe
which will start the node-red editor without starting the flows. Then you can edit the flows (disabling tabs may be a good start to find where the loop is) and the flows will start when you deploy. You can check in top to see if it is ok, and if it is still hogging the processsor then reboot again and make some more edits.