Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Unsolved
Collapse
Discussion Forum to share and further the development of home control and automation, independent of platforms.
  1. Home
  2. Software
  3. Multi-System Reactor
  4. Help updating node.js for bare metal install
Can´t restart or upgrade/deploy MSR
F
Topic thumbnail image
Multi-System Reactor
[Solved] Limit HA Entity in MSR
wmarcolinW
Topic thumbnail image
Multi-System Reactor
Reactor (Multi-System/Multi-Hub) Announcements
toggledbitsT
Build 21228 has been released. Docker images available from DockerHub as usual, and bare-metal packages here. Home Assistant up to version 2021.8.6 supported; the online version of the manual will now state the current supported versions; Fix an error in OWMWeatherController that could cause it to stop updating; Unify the approach to entity filtering on all hub interface classes (controllers); this works for device entities only; it may be extended to other entities later; Improve error detail in messages for EzloController during auth phase; Add isRuleSet() and isRuleEnabled() functions to expressions extensions; Implement set action for lock and passage capabilities (makes them more easily scriptable in some cases); Fix a place in the UI where 24-hour time was not being displayed.
Multi-System Reactor
Organizing/ structuring rule sets and rules
R
Hi guys, Just wondering how you guys organize your rule sets and rules. I wish I had an extra layer to have some more granularity, but my feature request was not popular. Maybe there are better ways to organize my rule sets. I use the rule sets now primarily for rooms. So a rule set per room. But maybe grouping by functionality works better. Any examples/ suggestions would be appreciated.
Multi-System Reactor
Moving MSR from a QNAP container to RP 5 - some issues
Tom_DT
Topic thumbnail image
Multi-System Reactor
Widget deletion does not work and landing page (status) is empy
M
Topic thumbnail image
Multi-System Reactor
Need help reducing false positive notifications
T
Topic thumbnail image
Multi-System Reactor
Deleting widgets
tunnusT
Hopefully a trivial question, but how do you delete widgets in a status page? Using build 22266
Multi-System Reactor
MQTT configuration question
tunnusT
I have the following yaml configuration in local_mqtt_devices file x_mqtt_device: set_speed: arguments: speed: type: str topic: "command/%friendly_name%" payload: type: json expr: '{ "fan": parameters.speed }' While this works fine, I'm wondering how this could be changed to "fixed" parameters, as in this case "fan" only accepts "A", "Q" or a numeric value of 1-5?
Multi-System Reactor
System Configuration Check - time is offset
F
Hi! I get this message when I'm on the status tab: System Configuration Check The time on this system and on the Reactor host are significantly different. This may be due to incorrect system configuration on either or both. Please check the configuration of both systems. The host reports 2025-04-01T15:29:29.252Z; browser reports 2025-04-01T15:29:40.528Z; difference 11.276 seconds. I have MSR installed as a docker on my Home Assistant Blue / Hardkernel ODROID-N2/N2+. MSR version is latest-25082-3c348de6. HA versions are: Core 2025.3.4 Supervisor 2025.03.4 Operating System 15.1 I have restarted HA as well as MSR multiple times. This message didn´t show two weeks ago. Don´t know if it have anything to do with the latest MSR version. Do anyone know what I can try? Thanks in advance! Let's Be Careful Out There (Hill Street reference...) /Fanan
Multi-System Reactor
Programmatically capture HTTP Request action status code or error
therealdbT
I have a very strange situation, where if InfluxDB restarts, other containers may fail when restarting at the same time (under not easy to understand circumstances), and InfluxDB remains unreachable (and these containers crashes). I need to reboot these containers in an exact order, after rebooting InfluxDB. While I understand what's going on, I need a way to reliable determine that InfluxDB is not reachable and these containers are not reachable, in order to identify this situation and manually check what's going on - and, maybe, in the future, automatically restart them if needed. So, I was looking at HTTP Request action, but I need to capture the HTTP response code, instead of the response (becase if ping is OK, InfluxDB will reply with a 204), and, potentially, a way to programmatically detect that it's failing to get the response. While I could write a custom HTTP controller for this or a custom HTTP virtual device, I was wondering if this is somewhat on you roadmap @toggledbits Thanks!
Multi-System Reactor
ZwaveJSUI - RGBWW BULB - Warm/Cold White interfered with RGB settings - Bulb doesn't change color if in WarmWhite state.
N
Hi , I'm on -Reactor (Multi-hub) latest-25067-62e21a2d -Docker on Synology NAS -ZWaveJSUI 9.31.0.6c80945 Problem with ZwaveJSUI: When I try to change color to a bulb RGBWW, it doesn't change to the RGB color and the bulb remains warm or cold white. I tryed with Zipato RGBW Bulb V2 RGBWE2, Hank Bulb HKZW-RGB01, Aentec 6 A-ZWA002, so seems that it happens with all RGBWW bulb with reactor/zwavejsui. I'm using from reator the entity action: "rgb_color.set" and "rgb_color.set_rgb". After I send the reactor command, It changes in zwavejsui the rgb settings but doesn't put the white channel to "0", so the prevalent channel remains warm/cold White and the bulb doesn't change into the rgb color. This is the status of the bulb in zwavejsui after "rgb_color.set" (235,33,33,) and the bulb is still warmWhite. x_zwave_values.Color_Switch_currentColor={"warmWhite":204,"coldWhite":0,"red":235,"green":33,"blue":33} The "cold white" and "warm white" settings interfer with the rgb color settings. Reactor can change bulb colors with rgb_color set — (value, ui8, 0x000000 to 0xffffff) or rgb_color set_rgb — (red, green, blue, all ui1, 0 to 255) but if warm or cold white are not to "0", zwavejsui doesn't change them and I can't find a way to change into rgb or from rgb back to warm white. So if I use from reactor: rgb_color set_rgb — (235,33,33) in zwavejsui I have x_zwave_values.Color_Switch_targetColor={"red":235,"green":33,"blue":33} 14/03/2025, 16:43:57 - value updated Arg 0: └─commandClassName: Color Switch └─commandClass: 51 └─property: targetColor └─endpoint: 0 └─newValue └──red: 235 └──green: 33 └──blue: 33 └─prevValue └──red: 235 └──green: 33 └──blue: 33 └─propertyName: targetColor 14/03/2025, 16:43:57 - value updated Arg 0: └─commandClassName: Color Switch └─commandClass: 51 └─property: currentColor └─endpoint: 0 └─newValue └──warmWhite: 204 └──coldWhite: 0 └──red: 235 └──green: 33 └──blue: 33 └─prevValue └──warmWhite: 204 └──coldWhite: 0 └──red: 235 └──green: 33 └──blue: 33 └─propertyName: currentColor In zwavejsui, the bulb changes rgb set but warm White remains to "204" and the bulb remais on warm White channel bacause is prevalent on rgb set. x_zwave_values.Color_Switch_currentColor_0=204 x_zwave_values.Color_Switch_currentColor_1=0 x_zwave_values.Color_Switch_currentColor_2=235 x_zwave_values.Color_Switch_currentColor_3=33 x_zwave_values.Color_Switch_currentColor_4=33 Is it possible to targetColor also for "warmWhite" and "coldWhite" and have something similar to this? x_zwave_values.Color_Switch_targetColor={"warmWhite":0,"coldWhite":0,"red":235,"green":33,"blue":33} Thanks in advance.
Multi-System Reactor
Problem with simultaneous notifications.
T
Topic thumbnail image
Multi-System Reactor
Problem after upgrading to 25067
R
MSR had been running fine, but I decided to follow the message to upgrade to 25067. Since the upgrade, I have received the message "Controller "<name>" (HubitatController hubitat2) could not be loaded at startup. Its ID is not unique." MSR throws the message on every restart. Has anyone else encountered this problem? I am running MSR on a Raspberry Pi4 connecting to two Hubitat units over an OpenVPN tunnel. One C8 and a C8 Pro. Both are up-to-date. It appears that despite the error message that MSR may be operating properly.
Multi-System Reactor
Global expressions not always evaluated
tunnusT
Topic thumbnail image
Multi-System Reactor
[Solved] Local expression evaluation
V
Topic thumbnail image
Multi-System Reactor
[Solved] Runtime error when exiting global reaction that contains a group
S
I am getting a Runtime error on different browsers when I click exit when editing an existing or creating a new global reaction containing a group. If the global reaction does not have a group I don't get an error. I see a similar post on the forum about a Runtime Error when creating reactions but started a new thread as that appears to be solved. The Runtime Error is different in the two browsers Safari v18.3 @http://192.168.10.21:8111/reactor/en-US/lib/js/reaction-list.js:171:44 You may report this error, but do not screen shot it. Copy-paste the complete text. Remember to include a description of the operation you were performing in as much detail as possible. Report using the Reactor Bug Tracker (in your left navigation) or at the SmartHome Community. Google Chrome 133.0.6943.142 TypeError: self.editor.isModified is not a function at HTMLButtonElement.<anonymous> (http://192.168.10.21:8111/reactor/en-US/lib/js/reaction-list.js:171:34) You may report this error, but do not screen shot it. Copy-paste the complete text. Remember to include a description of the operation you were performing in as much detail as possible. Report using the Reactor Bug Tracker (in your left navigation) or at the SmartHome Community. Steps to reproduce: Click the pencil to edit a global reaction with a group. Click the Exit button. Runtime error appears. or Click Create Reaction Click Add Action Select Group Add Condition such as Entity Attribute. Add an Action. Click Save Click Exit Runtime error appears. I don’t know how long the error has been there as I haven’t edited the global reaction in a long time. Reactor (Multi-hub) latest-25060-f32eaa46 Docker Mac OS: 15.3.1 Thanks
Multi-System Reactor
Cannot delete Global Expressions
SnowmanS
I am trying to delete a global expression (gLightDelay) but for some strange reason, it comes back despite clicking the Delete this expression and Save Changes buttons. I have not created a global expression for some times and just noticed this while doing some clean-up. I have upgraded Reactor to 25067 from 25060 and the behaviour is still there. I have restarted Reactor (as well as restarting its container) and cleared the browser's cache several times without success. Here's what the log shows. [latest-25067]2025-03-08T23:50:22.690Z <wsapi:INFO> [WSAPI]wsapi#1 rpc_echo [Object]{ "comment": "UI activity" } [latest-25067]2025-03-08T23:50:26.254Z <GlobalExpression:NOTICE> Deleting global expression gLightDelay [latest-25067]2025-03-08T23:50:27.887Z <wsapi:INFO> [WSAPI]wsapi#1 rpc_echo [Object]{ "comment": "UI activity" } Reactor latest-25067-62e21a2d Docker on Synology NAS
Multi-System Reactor
Local notification methods?
CatmanV2C
Morning, experts. Hard on learning about the internet check script in MSR tools, I was wondering what suggestions anyone has about a local (i.e. non-internet dependent) notification method. This was prompted by yesterday's fun and games with my ISP. I've got the script Cronned and working properly but short of flashing a light on and off, I'm struggling to think of a way of alerting me (ideally to my phone) I guess I could set up a Discord server at home, but that feels like overkill for a rare occasion. Any other suggestions? TIA C
Multi-System Reactor
Custom capabilities in MQTT templates
M
Hi, I'm trying to integrate the sonos-mqtt (https://sonos2mqtt.svrooij.io/) with the MSR and it's coming along nicely so far. But cannot wrap my head around how to define custom capabilities in MQTT templates. I need this for the TTS announcements and similarly for the notification sounds where I would pass the sound file as parameter. So this is what I have in the local_mqtt_devices.yaml capabilities: x_sonos_announcement: attributes: actions: speak: arguments: text: type: string volume: type: int delay: type: int And this is the template: templates: sonos-announcement: capabilities: - x_sonos_announcement actions: x_sonos_announcement: speak: topic: "sonos/cmd/speak" payload: expr: > { "text": parameters.text, "volume": parameters.volume, "delayMs": parameters.delay, "onlyWhenPlaying": false, "engine": "neural" } type: json So the speak action should send something like this to topic sonos/cmd/speak { "text": "message goes here", "volume": 50, "delayMs": 100, "onlyWhenPlaying": false, "engine": "neural" } At startup the MSR seems to be quite unhappy with my configuration: reactor | [latest-25016]2025-02-09T08:19:59.029Z <MQTTController:WARN> MQTTController#mqtt entity Entity#mqtt>sonos-announcement unable to configure capabilities [Array][ "x_sonos_announcement" ] reactor | i18n: missing fi-FI language string: Configuration for {0:q} is incomplete because the following requested capabilities are undefined: {1} reactor | i18n: missing fi-FI language string: Configuration for {0:q} has unrecognized capability {1:q} in actions reactor | Trace: Configuration for {0:q} is incomplete because the following requested capabilities are undefined: {1} reactor | at _T (/opt/reactor/server/lib/i18n.js:611:28) reactor | at AlertManager.addAlert (/opt/reactor/server/lib/AlertManager.js:125:25) reactor | at MQTTController.sendWarning (/opt/reactor/server/lib/Controller.js:627:30) reactor | at MQTTController.start (/var/reactor/ext/MQTTController/MQTTController.js:268:26) reactor | at async Promise.allSettled (index 0) Configuration for "sonos-announcement" has unrecognized capability "x_sonos_announcement" in actions Controller: MQTTController#mqtt Last 10:21:37 AM Configuration for "sonos-announcement" is incomplete because the following requested capabilities are undefined: x_sonos_announcement Controller: MQTTController#mqtt Last 10:21:37 AM This is probably a pretty stupid question and the approach may not even work at all, but maybe someone or @toggledbits for sure, could point me to the right direction. Basically the idea is to be able to send TTS messages from reactions using entity actions. I've previously used HTTP requests to Sonos HTTP API (https://hub.docker.com/r/chrisns/docker-node-sonos-http-api/) for the same functionality, but since moving to sonos-mqtt, I need a way to send the TTS notifications using MQTTController. Along with the actual message, volume and delay must also be parameterizable. br, mgvra MSR latest-25016-d47fea38 / MQTTController [0.2.24293]
Multi-System Reactor

Help updating node.js for bare metal install

Scheduled Pinned Locked Moved Multi-System Reactor
14 Posts 6 Posters 6.3k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gwp1
    wrote on last edited by
    #5

    I had same issue and went back to the MSR manual where it noted if you didn't have a system install of nodejs MSR would do a local one for just it's user.

    I reran the opening steps from the manual and it updated to 18.x just fine.

    *Hubitat C-7 2.4.1.151
    *Proxmox VE v8, Beelink MiniPC 12GBs, SSD

    *HASS 2025.3.4
    w/ ZST10-700 fw 7.18.3

    *Prod MSR in docker/portainer
    MSR: latest-25082-3c348de6
    MQTTController: 24257
    ZWave Controller: 25082

    1 Reply Last reply
    0
    • cw-kidC Offline
      cw-kidC Offline
      cw-kid
      wrote on last edited by cw-kid
      #6

      Thanks for the replies and tips.

      In the end after more Googling for my Debian Buster install this seems to have fixed it for me.

      I removed the new /usr/local/bin/node directory that got installed the other day.

      rm /usr/local/bin/node

      Then running the command "which node" the path was back to the old path of /usr/bin/node and "node -v" was showing the old version again of 16.20.2

      I then found these commands on Google and tried them:

      curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -

      sudo apt-get install -y nodejs

      This seems to have upgraded the 16.20.2 version with a newer version, I saw this line in the terminal output

      Unpacking nodejs (20.5.1-deb-1nodesource1) over (16.20.2-deb-1nodesource1)

      Now when I do a node -v it says its version 20.5.1 and the alert message in MSR has now gone.

      "which node" still says the path is the original path of /usr/bin/node also.

      I have no idea if this was the correct way to do it but I think it has worked.

      1 Reply Last reply
      0
      • wmarcolinW Offline
        wmarcolinW Offline
        wmarcolin
        wrote on last edited by
        #7

        I think we all have a similar problem. My step-by-step was as follows.

        sudo apt remove nodejs
        sudo apt remove npm
        sudo apt autoremove
        
        sudo apt purge nodejs
        sudo apt purge npm
        sudo apt autoremove
        
        sudo apt-get update
        sudo apt-get install -y ca-certificates curl gnupg
        sudo mkdir -p /etc/apt/keyrings
        curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
        
        NODE_MAJOR=20
        echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
        
        sudo apt-get update
        sudo apt-get install nodejs -y
        

        Now comes the very rare story, if I'm not as toot I get this information.

        node -v
        v20.10.0
        
        npm -v
        10.2.3
        
        

        PERFECT!!

        But after the su --, I become root and the version that comes is 12? and then I really don't understand. I did the tasks like this, as root and without root, in the same way.

        If any expert can help me understand this madness.

        Thanks.

        1 Reply Last reply
        0
        • toggledbitsT Away
          toggledbitsT Away
          toggledbits
          wrote on last edited by
          #8

          The PATH environment variable for root is different from that of regular users. You can echo $PATH in each to see the differences. The path is processed in order, first come first served.

          Author of Multi-system Reactor and Reactor, DelayLight, Switchboard, and about a dozen other plugins that run on Vera and openLuup.

          1 Reply Last reply
          1
          • wmarcolinW Offline
            wmarcolinW Offline
            wmarcolin
            wrote on last edited by
            #9

            Well, I've just solved my problem, whether it's the right way or not I can't say, but it was brute force, I used the "which node" command, I located all the directories regardless of version and deleted them (rm node -r), this while being root. Then I did a fresh install 🙂 solved.

            toggledbitsT 1 Reply Last reply
            0
            • wmarcolinW wmarcolin

              Well, I've just solved my problem, whether it's the right way or not I can't say, but it was brute force, I used the "which node" command, I located all the directories regardless of version and deleted them (rm node -r), this while being root. Then I did a fresh install 🙂 solved.

              toggledbitsT Away
              toggledbitsT Away
              toggledbits
              wrote on last edited by toggledbits
              #10

              @wmarcolin That may have worked, but it's not strictly right and may lead to complications down the road, like versions of node and npm being out of sync.

              NOTE: Some of this can be used as instructions. Read all carefully and understand what you are doing before you actually do anything. If you don't understand, ask first, understand first, then proceed (always with caution and careful attention to detail).

              Generally speaking, it's not a good idea to tamper with the system-installed version of any utility if there is one. If you use a command like apt-get install node or similar and it puts a version into /usr/bin, that's where you should leave it, and never change it (unless apt or yum does). That's because the system packages are versioned together as a group, so other system utilities may have dependencies on that system-blessed version of the package and its associated utilities and libraries.

              When you want a newer version of node, the generally-recommended way is to do a custom install, which can be done either to a user-specific directory (so that one user can have a private version), or system-wide in a location under /usr/local (usually installed in /usr/local/lib with symbolic links from /usr/local/bin for the executables).

              Either way, the version of node that runs is the first one encountered in the PATH environment then in effect.

              Reactor has been tested with all three common install methods: the native system packages, when up to date; a /usr/local install; and a user-directory-specific install. All work fine.

              Taking the structure of one of my RPis running Raspbian Buster (Debian 10), but should apply to almost any Linux-based platform...

              The default system install puts a node and npm in /usr/bin:

              pi@rpi4-2:~ $ ls -l /usr/bin/node
              -rwxr-xr-x 1 root root 5536 Feb 24  2023 /usr/bin/node
              pi@rpi4-2:~ $ /usr/bin/node -v
              v10.24.0
              pi@rpi4-2:~ $
              

              Notice that when I ran the node command, I ran it with a full path (i.e. as /usr/bin/node and not just typing node). That's because I have a newer version of node installed in /usr/local that is configured to take precedence. And also notice how old that system-installed package is!

              My later-version installation in /usr/local/lib (specifically) looks like this:

              pi@rpi4-2:~ $ ls -l /usr/local/lib/
              total 12
              drwxr-xr-x 3 root root  4096 Nov 26 08:59 nodejs
              drwxrwsr-x 4 root staff 4096 Nov 26 09:13 python2.7
              drwxrwsr-x 3 root staff 4096 May  7  2021 python3.7
              pi@rpi4-2:~ $ ls -l /usr/local/lib/nodejs
              total 42112
              drwxr-xr-x 6 1001 1001     4096 Oct 13 10:03 node-v18.18.2-linux-armv7l
              -rw-r--r-- 1 root root 20932900 Oct 13 10:05 node-v18.18.2-linux-armv7l.tar.xz
              -rw-r--r-- 1 root root 22182716 Nov 22 07:30 node-v20.10.0-linux-armv7l.tar.xz
              pi@rpi4-2:~ $
              

              You can see here, I have a nodejs subdirectory in /usr/local/lib. In here, I've got the downloaded archives for two versions (an 18 and a 20), of which the 18 is currently unpacked in the directory node-v18.18.2-linux-armv7l. That's a completely self-contained package for nodejs, ready to run. All that was needed was to configure it to run.

              Configuring this version of node to run took two additional steps. First, I went to /usr/local/bin, and symbolically linked the executables from the v18 package, like this (notice I'm doing this step as root) :

              root@rpi4-2:~# cd /usr/local/bin
              root@rpi4-2:/usr/local/bin# ln -sf /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/* .
              root@rpi4-2:/usr/local/bin# ls -l
              total 4
              lrwxrwxrwx 1 root root 61 Dec 11 12:30 corepack -> /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/corepack
              lrwxrwxrwx 1 root root 57 Dec 11 12:30 node -> /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/node
              lrwxrwxrwx 1 root root 56 Dec 11 12:30 npm -> /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/npm
              lrwxrwxrwx 1 root root 56 Dec 11 12:30 npx -> /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/npx
              root@rpi4-2:/usr/local/bin#
              

              The first command changes directory to /usr/local/bin, and the second symbolically links all files in the package's bin subdirectory to the current directory (which is our /usr/local/bin). The ls command shows the result of that operation. So you can see, the executable in /usr/local/bin/node isn't an executable at all, it's a symbolic link to the executable in the package directory. Same with the other nodejs commands in the package.

              The last step is to get that executable in /usr/local/bin/node to take precedence over the older version in the system install (i.e. the one in /usr/bin/node). All that is required to do this is that /usr/local/bin/node be seen by the shell before /usr/bin/node. This is done by making sure /usr/local/bin comes before /usr/bin in the PATH environment variable. On most systems, this is already the default case -- it's set up that way and you don't need to do anything. On some systems, you may need to add it. This can be done by adding a snippet like the following to the end of /etc/profile (to make it a system-wide change):

              PATH=/usr/local/bin:$PATH
              export PATH
              

              This puts /usr/local/bin at the head of the PATH. Again, this usually isn't necessary, because /usr/local/bin is already early in the path on most systems by default. You can check your path by doing echo $PATH as I said before. If you do end up having to make this change, you'll need to log out and log back in to make it take effect. And, any time you edit anything in /etc, it's a good idea to make a backup copy of the unmodified file first, in case you goof something up and need to revert (cp /etc/profile /etc/profile.old is sufficient).

              If you're installing a per-user version of nodejs, the structure is fairly similar, but rather than unpacking the nodejs archive into /usr/local/lib/nodejs, you unpack it into ~/.local/lib/nodejs/ (remember ~ is a synonym for $HOME and means the current user's home directory path) with the same structure that I showed above for /usr/local/.... Notice we are not root here!

              # For user-local install, all work is done NOT as root. Here, I'm just "pi"
              pi@rpi4-2:~ $ mkdir -p ~/.local/lib
              pi@rpi4-2:~ $ mkdir -p ~/.local/bin
              pi@rpi4-2:~ $ cd ~/.local/lib/
              pi@rpi4-2:~/.local/lib $ mkdir -p nodejs
              pi@rpi4-2:~/.local/lib $ cd nodejs
              pi@rpi4-2:~/.local/lib/nodejs $ wget 'https://nodejs.org/dist/latest-v20.x/node-v20.10.0-linux-armv7l.tar.xz'
              --2023-12-11 12:46:55--  https://nodejs.org/dist/latest-v20.x/node-v20.10.0-linux-armv7l.tar.xz
              Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, 2606:4700:10::6814:162e, ...
              Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... connected.
              HTTP request sent, awaiting response... 200 OK
              Length: 22182716 (21M) [application/x-xz]
              Saving to: ânode-v20.10.0-linux-armv7l.tar.xz.1â
              
              node-v20.10.0-linux-armv7l.tar.x 100%[==========================================================>]  21.15M  18.5MB/s    in 1.1s
              
              2023-12-11 12:46:57 (18.5 MB/s) - ânode-v20.10.0-linux-armv7l.tar.xz.1â saved [22182716/22182716]
              
              pi@rpi4-2:~/.local/lib/nodejs $ ls
              node-v20.10.0-linux-armv7l.tar.xz
              pi@rpi4-2:~/.local/lib/nodejs $ tar xJf node-v20.10.0-linux-armv7l.tar.xz    # J is for .xz, z is for .gz
              pi@rpi4-2:~/.local/lib/nodejs $ cd ~/.local/bin
              pi@rpi4-2:~/.local/bin $ ln -sf ~/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/* .
              pi@rpi4-2:~/.local/bin $ ls -l
              total 16
              lrwxrwxrwx 1 pi pi 66 Dec 11 12:48 corepack -> /home/pi/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/corepack
              lrwxrwxrwx 1 pi pi 62 Dec 11 12:48 node -> /home/pi/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/node
              lrwxrwxrwx 1 pi pi 61 Dec 11 12:48 npm -> /home/pi/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/npm
              lrwxrwxrwx 1 pi pi 61 Dec 11 12:48 npx -> /home/pi/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/npx
              pi@rpi4-2:~/.local/bin $
              

              Reading these steps, the first five commands create the structure of the .local subdirectory needed, with subdirectories bin, lib and lib/nodejs within just like we would have in /usr/local. At this point, the current directory is ~/.local/lib/nodejs, and the wget command is used to download the nodejs package we want (change version and architecture to what you need if you are actually doing this). Then we un-tar it right where we are. After un-taring it, we change directory to our own ~/.local/bin and make the symbolic links for the nodejs commands in the package directory, just like we did for /usr/local.

              The last step is again, and this may be default, is making sure this user's PATH environment variable includes our new local ~/.local/bin directory. Check it with echo $PATH to see if you need to make the addition. If so, the easiest way to do that is to add the following snipped to ~/.profile, which is the per-user equivalent to /etc/profile (the per-user script runs after the /etc script at login) to set up the shell environment. My Raspbian Buster (Debian 10) systems seem to have this done already as a default, so before making any changes, check your PATH and/or ~/.profile.

              PATH=$HOME/.local/bin:$PATH
              export PATH
              

              Log out and back in, and then a which node should give you ~/.local/bin/node (or /home/username/.local/bin/node). You then have a per-user custom version of nodejs that doesn't interfere with any system versions.

              Now, for running Reactor as a service, you need to be aware of where you are running it, and as who. It's generally not recommended to run Reactor as root on any bare-metal system (it runs as root on docker containers, but that's OK because the container is a constrained virtual environment). So when setting up, for example, your systemd profile for Reactor, you would want to make sure the profile contains both a User directory to set the correct (non-root) user for the running process, and a full path to the correct node executable in ExecStart (e.g. ExecStart=/home/pi/.local/bin/node app -p).

              One last point: nodejs is so well-written that its entire dependencies exist entirely within its package structure, so whatever node command runs knows automatically where to find everything else it needs — you don't need to set a bunch of other environment variables to make each version work properly. That means you could, for example, run /usr/bin/node and see a perfectly working v10.24.0 as I showed above, or /usr/local/bin/node and get a perfectly-working v18.18.2 if that's what is installed there, and ~/.local/bin/node to get a fine v20.9.0 environment if that's what's installed there. Not all packages are this tight, and we can be grateful for it.

              Tip: don't stop at which node when you are trying to figure out what is running. nodejs itself makes extensive use of symbolic links, so doing which node is only the tip of the iceberg. You need to then do ls -l /that-path and see if it's a symbolic link to somewhere else, as I showed in the output above. Keep following those links until you find the "real deal" and you'll find which version is actually running and where it actually lives.

              I hope some of this clarifies how nodejs is installed, and highlights how you can actually have multiple versions of it installed on the system and they co-exist quite well, you just have to be careful.

              Author of Multi-system Reactor and Reactor, DelayLight, Switchboard, and about a dozen other plugins that run on Vera and openLuup.

              wmarcolinW 1 Reply Last reply
              3
              • CatmanV2C Offline
                CatmanV2C Offline
                CatmanV2
                wrote on last edited by
                #11

                @toggledbits fabulous post, there. Thanks. 18.19.0 in /usr/local/bin for Reactor and, apparently working fine 🙂

                Any particular reason not to go to 21?

                Cheers

                C

                The Ex-Vera abuser know as CatmanV2.....

                toggledbitsT 1 Reply Last reply
                0
                • CatmanV2C CatmanV2

                  @toggledbits fabulous post, there. Thanks. 18.19.0 in /usr/local/bin for Reactor and, apparently working fine 🙂

                  Any particular reason not to go to 21?

                  Cheers

                  C

                  toggledbitsT Away
                  toggledbitsT Away
                  toggledbits
                  wrote on last edited by toggledbits
                  #12

                  @CatmanV2 said in Help updating node.js for bare metal install:

                  Any particular reason not to go to 21?

                  Yes! Only even-numbered versions of nodejs are LTS (long-term support). For the longest life of the system between upgrades like this, use the LTS versions only. That's why I recommend 18 and 20.

                  Here's their release and support calendar: https://nodejs.github.io/nodejs.dev/en/about/releases/

                  Notice that 21 will be EOL far sooner than either 18 or 20.

                  Author of Multi-system Reactor and Reactor, DelayLight, Switchboard, and about a dozen other plugins that run on Vera and openLuup.

                  1 Reply Last reply
                  1
                  • CatmanV2C Offline
                    CatmanV2C Offline
                    CatmanV2
                    wrote on last edited by
                    #13

                    Doh! Thanks for that!

                    C

                    The Ex-Vera abuser know as CatmanV2.....

                    1 Reply Last reply
                    0
                    • toggledbitsT toggledbits

                      @wmarcolin That may have worked, but it's not strictly right and may lead to complications down the road, like versions of node and npm being out of sync.

                      NOTE: Some of this can be used as instructions. Read all carefully and understand what you are doing before you actually do anything. If you don't understand, ask first, understand first, then proceed (always with caution and careful attention to detail).

                      Generally speaking, it's not a good idea to tamper with the system-installed version of any utility if there is one. If you use a command like apt-get install node or similar and it puts a version into /usr/bin, that's where you should leave it, and never change it (unless apt or yum does). That's because the system packages are versioned together as a group, so other system utilities may have dependencies on that system-blessed version of the package and its associated utilities and libraries.

                      When you want a newer version of node, the generally-recommended way is to do a custom install, which can be done either to a user-specific directory (so that one user can have a private version), or system-wide in a location under /usr/local (usually installed in /usr/local/lib with symbolic links from /usr/local/bin for the executables).

                      Either way, the version of node that runs is the first one encountered in the PATH environment then in effect.

                      Reactor has been tested with all three common install methods: the native system packages, when up to date; a /usr/local install; and a user-directory-specific install. All work fine.

                      Taking the structure of one of my RPis running Raspbian Buster (Debian 10), but should apply to almost any Linux-based platform...

                      The default system install puts a node and npm in /usr/bin:

                      pi@rpi4-2:~ $ ls -l /usr/bin/node
                      -rwxr-xr-x 1 root root 5536 Feb 24  2023 /usr/bin/node
                      pi@rpi4-2:~ $ /usr/bin/node -v
                      v10.24.0
                      pi@rpi4-2:~ $
                      

                      Notice that when I ran the node command, I ran it with a full path (i.e. as /usr/bin/node and not just typing node). That's because I have a newer version of node installed in /usr/local that is configured to take precedence. And also notice how old that system-installed package is!

                      My later-version installation in /usr/local/lib (specifically) looks like this:

                      pi@rpi4-2:~ $ ls -l /usr/local/lib/
                      total 12
                      drwxr-xr-x 3 root root  4096 Nov 26 08:59 nodejs
                      drwxrwsr-x 4 root staff 4096 Nov 26 09:13 python2.7
                      drwxrwsr-x 3 root staff 4096 May  7  2021 python3.7
                      pi@rpi4-2:~ $ ls -l /usr/local/lib/nodejs
                      total 42112
                      drwxr-xr-x 6 1001 1001     4096 Oct 13 10:03 node-v18.18.2-linux-armv7l
                      -rw-r--r-- 1 root root 20932900 Oct 13 10:05 node-v18.18.2-linux-armv7l.tar.xz
                      -rw-r--r-- 1 root root 22182716 Nov 22 07:30 node-v20.10.0-linux-armv7l.tar.xz
                      pi@rpi4-2:~ $
                      

                      You can see here, I have a nodejs subdirectory in /usr/local/lib. In here, I've got the downloaded archives for two versions (an 18 and a 20), of which the 18 is currently unpacked in the directory node-v18.18.2-linux-armv7l. That's a completely self-contained package for nodejs, ready to run. All that was needed was to configure it to run.

                      Configuring this version of node to run took two additional steps. First, I went to /usr/local/bin, and symbolically linked the executables from the v18 package, like this (notice I'm doing this step as root) :

                      root@rpi4-2:~# cd /usr/local/bin
                      root@rpi4-2:/usr/local/bin# ln -sf /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/* .
                      root@rpi4-2:/usr/local/bin# ls -l
                      total 4
                      lrwxrwxrwx 1 root root 61 Dec 11 12:30 corepack -> /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/corepack
                      lrwxrwxrwx 1 root root 57 Dec 11 12:30 node -> /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/node
                      lrwxrwxrwx 1 root root 56 Dec 11 12:30 npm -> /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/npm
                      lrwxrwxrwx 1 root root 56 Dec 11 12:30 npx -> /usr/local/lib/nodejs/node-v18.18.2-linux-armv7l/bin/npx
                      root@rpi4-2:/usr/local/bin#
                      

                      The first command changes directory to /usr/local/bin, and the second symbolically links all files in the package's bin subdirectory to the current directory (which is our /usr/local/bin). The ls command shows the result of that operation. So you can see, the executable in /usr/local/bin/node isn't an executable at all, it's a symbolic link to the executable in the package directory. Same with the other nodejs commands in the package.

                      The last step is to get that executable in /usr/local/bin/node to take precedence over the older version in the system install (i.e. the one in /usr/bin/node). All that is required to do this is that /usr/local/bin/node be seen by the shell before /usr/bin/node. This is done by making sure /usr/local/bin comes before /usr/bin in the PATH environment variable. On most systems, this is already the default case -- it's set up that way and you don't need to do anything. On some systems, you may need to add it. This can be done by adding a snippet like the following to the end of /etc/profile (to make it a system-wide change):

                      PATH=/usr/local/bin:$PATH
                      export PATH
                      

                      This puts /usr/local/bin at the head of the PATH. Again, this usually isn't necessary, because /usr/local/bin is already early in the path on most systems by default. You can check your path by doing echo $PATH as I said before. If you do end up having to make this change, you'll need to log out and log back in to make it take effect. And, any time you edit anything in /etc, it's a good idea to make a backup copy of the unmodified file first, in case you goof something up and need to revert (cp /etc/profile /etc/profile.old is sufficient).

                      If you're installing a per-user version of nodejs, the structure is fairly similar, but rather than unpacking the nodejs archive into /usr/local/lib/nodejs, you unpack it into ~/.local/lib/nodejs/ (remember ~ is a synonym for $HOME and means the current user's home directory path) with the same structure that I showed above for /usr/local/.... Notice we are not root here!

                      # For user-local install, all work is done NOT as root. Here, I'm just "pi"
                      pi@rpi4-2:~ $ mkdir -p ~/.local/lib
                      pi@rpi4-2:~ $ mkdir -p ~/.local/bin
                      pi@rpi4-2:~ $ cd ~/.local/lib/
                      pi@rpi4-2:~/.local/lib $ mkdir -p nodejs
                      pi@rpi4-2:~/.local/lib $ cd nodejs
                      pi@rpi4-2:~/.local/lib/nodejs $ wget 'https://nodejs.org/dist/latest-v20.x/node-v20.10.0-linux-armv7l.tar.xz'
                      --2023-12-11 12:46:55--  https://nodejs.org/dist/latest-v20.x/node-v20.10.0-linux-armv7l.tar.xz
                      Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, 2606:4700:10::6814:162e, ...
                      Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... connected.
                      HTTP request sent, awaiting response... 200 OK
                      Length: 22182716 (21M) [application/x-xz]
                      Saving to: ânode-v20.10.0-linux-armv7l.tar.xz.1â
                      
                      node-v20.10.0-linux-armv7l.tar.x 100%[==========================================================>]  21.15M  18.5MB/s    in 1.1s
                      
                      2023-12-11 12:46:57 (18.5 MB/s) - ânode-v20.10.0-linux-armv7l.tar.xz.1â saved [22182716/22182716]
                      
                      pi@rpi4-2:~/.local/lib/nodejs $ ls
                      node-v20.10.0-linux-armv7l.tar.xz
                      pi@rpi4-2:~/.local/lib/nodejs $ tar xJf node-v20.10.0-linux-armv7l.tar.xz    # J is for .xz, z is for .gz
                      pi@rpi4-2:~/.local/lib/nodejs $ cd ~/.local/bin
                      pi@rpi4-2:~/.local/bin $ ln -sf ~/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/* .
                      pi@rpi4-2:~/.local/bin $ ls -l
                      total 16
                      lrwxrwxrwx 1 pi pi 66 Dec 11 12:48 corepack -> /home/pi/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/corepack
                      lrwxrwxrwx 1 pi pi 62 Dec 11 12:48 node -> /home/pi/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/node
                      lrwxrwxrwx 1 pi pi 61 Dec 11 12:48 npm -> /home/pi/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/npm
                      lrwxrwxrwx 1 pi pi 61 Dec 11 12:48 npx -> /home/pi/.local/lib/nodejs/node-v20.10.0-linux-armv7l/bin/npx
                      pi@rpi4-2:~/.local/bin $
                      

                      Reading these steps, the first five commands create the structure of the .local subdirectory needed, with subdirectories bin, lib and lib/nodejs within just like we would have in /usr/local. At this point, the current directory is ~/.local/lib/nodejs, and the wget command is used to download the nodejs package we want (change version and architecture to what you need if you are actually doing this). Then we un-tar it right where we are. After un-taring it, we change directory to our own ~/.local/bin and make the symbolic links for the nodejs commands in the package directory, just like we did for /usr/local.

                      The last step is again, and this may be default, is making sure this user's PATH environment variable includes our new local ~/.local/bin directory. Check it with echo $PATH to see if you need to make the addition. If so, the easiest way to do that is to add the following snipped to ~/.profile, which is the per-user equivalent to /etc/profile (the per-user script runs after the /etc script at login) to set up the shell environment. My Raspbian Buster (Debian 10) systems seem to have this done already as a default, so before making any changes, check your PATH and/or ~/.profile.

                      PATH=$HOME/.local/bin:$PATH
                      export PATH
                      

                      Log out and back in, and then a which node should give you ~/.local/bin/node (or /home/username/.local/bin/node). You then have a per-user custom version of nodejs that doesn't interfere with any system versions.

                      Now, for running Reactor as a service, you need to be aware of where you are running it, and as who. It's generally not recommended to run Reactor as root on any bare-metal system (it runs as root on docker containers, but that's OK because the container is a constrained virtual environment). So when setting up, for example, your systemd profile for Reactor, you would want to make sure the profile contains both a User directory to set the correct (non-root) user for the running process, and a full path to the correct node executable in ExecStart (e.g. ExecStart=/home/pi/.local/bin/node app -p).

                      One last point: nodejs is so well-written that its entire dependencies exist entirely within its package structure, so whatever node command runs knows automatically where to find everything else it needs — you don't need to set a bunch of other environment variables to make each version work properly. That means you could, for example, run /usr/bin/node and see a perfectly working v10.24.0 as I showed above, or /usr/local/bin/node and get a perfectly-working v18.18.2 if that's what is installed there, and ~/.local/bin/node to get a fine v20.9.0 environment if that's what's installed there. Not all packages are this tight, and we can be grateful for it.

                      Tip: don't stop at which node when you are trying to figure out what is running. nodejs itself makes extensive use of symbolic links, so doing which node is only the tip of the iceberg. You need to then do ls -l /that-path and see if it's a symbolic link to somewhere else, as I showed in the output above. Keep following those links until you find the "real deal" and you'll find which version is actually running and where it actually lives.

                      I hope some of this clarifies how nodejs is installed, and highlights how you can actually have multiple versions of it installed on the system and they co-exist quite well, you just have to be careful.

                      wmarcolinW Offline
                      wmarcolinW Offline
                      wmarcolin
                      wrote on last edited by
                      #14

                      @toggledbits

                      Super thanks for the master class!!!!

                      1 Reply Last reply
                      1
                      • toggledbitsT toggledbits locked this topic on
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      Recent Topics

                      • Z-Wave Future....
                        CatmanV2C
                        CatmanV2
                        0
                        5
                        90

                      • Can´t restart or upgrade/deploy MSR
                        toggledbitsT
                        toggledbits
                        0
                        4
                        59

                      • [Solved] Limit HA Entity in MSR
                        wmarcolinW
                        wmarcolin
                        0
                        7
                        157

                      • Reactor (Multi-System/Multi-Hub) Announcements
                        toggledbitsT
                        toggledbits
                        5
                        121
                        35.3k

                      • Disaster recovery and virtualisation
                        CatmanV2C
                        CatmanV2
                        0
                        5
                        644

                      • Remote access of Zwave stick from Z-wave server
                        CatmanV2C
                        CatmanV2
                        0
                        3
                        368

                      • Organizing/ structuring rule sets and rules
                        G
                        gwp1
                        0
                        5
                        367

                      • Moving MSR from a QNAP container to RP 5 - some issues
                        G
                        gwp1
                        0
                        5
                        331

                      • Widget deletion does not work and landing page (status) is empy
                        G
                        gwp1
                        0
                        4
                        323

                      • Need help reducing false positive notifications
                        T
                        tamorgen
                        0
                        7
                        502

                      • Deleting widgets
                        toggledbitsT
                        toggledbits
                        0
                        4
                        459
                      Powered by NodeBB | Contributors
                      Hosted freely by 10RUPTiV - Solutions Technologiques | Contact us
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Unsolved