@toggledbits I understand that you do not perform testing on Mac computers but thought I'd share the following with you in case something can be done.
I started seeing these errors with version 24302. I thought that upgrading to 24343 would have fixed the issue but unfortunately not. I either have to close the browser or clear the cache for the errors to stop popping-up but they slowly come back.
I see these errors on the following browsers:
Safari 16.6.1 on macOS Big Sur Safari 18.1.1 on MacOS Sonoma DuckDuckGo 1.118.0 on macOS Big Sur and Sonoma Firefox 133.0.3 on macOS Big Sur Chrome 131.0.6778 on macOS Big SurHere are the errors
Safari while creating/updating an expression
@http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:543:91 makeExprMenu@http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:537:28 @http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:92:64 @http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:89:68 each@http://192.168.0.13:8111/node_modules/jquery/dist/jquery.min.js:2:3133 @http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:89:35 @http://192.168.0.13:8111/client/MessageBus.js:98:44 forEach@[native code] @http://192.168.0.13:8111/client/MessageBus.js:95:54 @http://192.168.0.13:8111/client/MessageBus.js:106:44 @http://192.168.0.13:8111/client/Observable.js:78:28 signalModified@http://192.168.0.13:8111/reactor/en-ca/lib/js/ee.js:146:21 signalModified@http://192.168.0.13:8111/reactor/en-ca/lib/js/expression-editor.js:40:29 reindexExpressions@http://192.168.0.13:8111/reactor/en-ca/lib/js/expression-editor.js:71:32 @http://192.168.0.13:8111/reactor/en-ca/lib/js/expression-editor.js:608:40 dispatch@http://192.168.0.13:8111/node_modules/jquery/dist/jquery.min.js:2:40040DuckDuckGo while clicking on status
http://192.168.0.13:8111/reactor/en-ca/lib/js/reactor-ui-status.js:789:44 asyncFunctionResume@[native code] saveGridLayout@[native code] dispatchEvent@[native code] _triggerEvent@http://192.168.0.13:8111/node_modules/gridstack/dist/gridstack.js:1401:30 _triggerAddEvent@http://192.168.0.13:8111/node_modules/gridstack/dist/gridstack.js:1383:31 makeWidget@http://192.168.0.13:8111/node_modules/gridstack/dist/gridstack.js:968:30 addWidget@http://192.168.0.13:8111/node_modules/gridstack/dist/gridstack.js:388:24 placeWidgetAdder@http://192.168.0.13:8111/reactor/en-ca/lib/js/reactor-ui-status.js:183:44Firefox while updating a rule
@http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:543:91 makeExprMenu@http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:537:28 @http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:92:64 @http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:89:68 each@http://192.168.0.13:8111/node_modules/jquery/dist/jquery.min.js:2:3133 @http://192.168.0.13:8111/reactor/en-ca/lib/js/reaction-editor.js:89:35 @http://192.168.0.13:8111/client/MessageBus.js:98:44 forEach@[native code] @http://192.168.0.13:8111/client/MessageBus.js:95:54 @http://192.168.0.13:8111/client/MessageBus.js:106:44 @http://192.168.0.13:8111/client/Observable.js:78:28 notifySaved@http://192.168.0.13:8111/reactor/en-ca/lib/js/ee.js:82:21 notifySaved@http://192.168.0.13:8111/reactor/en-ca/lib/js/expression-editor.js:47:26 @http://192.168.0.13:8111/reactor/en-ca/lib/js/reactor-ui-rules.js:1460:39 forEach@[native code] @http://192.168.0.13:8111/reactor/en-ca/lib/js/reactor-ui-rules.js:1459:58Chrome while creating/updating an expression
TypeError: Cannot read properties of undefined (reading 'getEditor') at RuleEditor.makeExprMenu (http://192.168.0.13:8111/reactor/en-ca/lib/js/rule-editor.js:1788:86) at Object.handler (http://192.168.0.13:8111/reactor/en-ca/lib/js/rule-editor.js:2174:54) at http://192.168.0.13:8111/client/MessageBus.js:98:44 at Array.forEach (<anonymous>) at MessageBus._sendToBus (http://192.168.0.13:8111/client/MessageBus.js:95:54) at MessageBus.send (http://192.168.0.13:8111/client/MessageBus.js:106:44) at ExpressionEditor.publish (http://192.168.0.13:8111/client/Observable.js:78:28) at ExpressionEditor.signalModified (http://192.168.0.13:8111/reactor/en-ca/lib/js/ee.js:146:14) at ExpressionEditor.signalModified (http://192.168.0.13:8111/reactor/en-ca/lib/js/expression-editor.js:40:15) at ExpressionEditor.reindexExpressions (http://192.168.0.13:8111/reactor/en-ca/lib/js/expression-editor.js:71:18) ``Thanks to @toggledbits for adding a custom CSS. I've started doing a darker Reactor style.
Here's the file: https://gist.github.com/dbochicchio/825098ac13b7f8cac22012eae37ff7ce
A couple of things are still too bright and I'll eventually catch-up. Just place it under your /config directory, naming the file as customstyles.css. Hard refresh your browser.
Hi
Having to rebuild my Linux Debian box as the SSD failed. And I have forgotten exactly what I did the first time to get it all setup.
I have Debian 12 up and running on the new SSD, I only have console no Desktop GUI.
I am trying to do the bare metal install for MSR. However I am not sure if I am meant to install nodejs whlist logged in as the root user or as the none root user with my name ?
I used putty and connected via SSH and logged in as root and I installed nodejs but I think this was wrong as when logged in as my user name and I do a node -v command it says node is not installed or doesn't show any version number anyway.
But when logged in as root and I do a node -v command it does show me its installed and displays the version number. maybe its a path issue for my username and he can't see node is installed?
So now I am thinking I should of installed node whilst logged in as my user name and not as the root user.
This is how I installed nodejs as whilst logged in as root
ac7bf6c3-23ad-46fc-8ada-44af6704e63e-image.png
Thanks in advance.
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.As the title says, here's my OpenAI Controller for Reactor:
OpenAI Controller per Reactor. Contribute to dbochicchio/reactor-openai development by creating an account on GitHub.
It supports both OpenAI and Azure OpenAI endpoints. You'll need keys/endpoints, according to each service.
The controller supports multiple models, and each one could be mapped as an entity.
It's quite easy to use, and responses can be stored in variables, for easy access. Or sent to another action (Text To Speech, another endpoint, etc).
9013ae50-fd68-42a2-87c3-97479132e465-image.png
80a88eec-7c89-464a-8196-690b4b72d044-image.png
Have fun with LLM into your scenes!
In Home Assistant I have an integration that if I add entities to it, I will get the following error in MSR as certain entity values I'm using in expressions are null for a moment. This is more or less cosmetic issue and happens very rarely as I rarely modify that integration on the hass side.
Screenshot 2024-11-28 at 22.20.41.png
And the expression is
Screenshot 2024-11-28 at 22.38.19.png
Could I "wrap" hass-entity shown above somewhat differently to prevent this error from happening? Using build 24302.
Hello
I am trying to set up Multi System Reactor to automate routines across multiple smart home devices & platforms (e.g., Home Assistant, SmartThings, and Hubitat). While I have successfully linked the systems; I am facing issues with:
-Delays in triggering actions on secondary devices.
-Inconsistent execution of complex logic conditions.
-Synchronization of states between devices when one system updates.
Is there a recommended way to optimize performance & confirm seamless state sharing across systems?
I have checked https://smarthome.community/category/22/multi-system-reactor-msbi guide for reference but still need advice.
Any tips on debugging or log analysis to pinpoint where the issue arises would also be appreciated.
Thank you !
I've managed to use MSR UI on iOS devices to some degree*, so that although UI elements (e.g. rule sets) are not visible in portrait mode, you've seen them in landscape. Now with recents builds (24302) this does not work anymore, elements (rule sets, entities) are not anymore visible in landscape mode.
Does anyone have similar experiences? Using iOS 18 and Safari/Chrome browser.
( *Drag & drop of rule conditions have never worked on a mobile)
@toggledbits Since I have upgraded ZWaveJSController to 24293 from 24257 I am seeing entries related to registering action set_volume, but action is not defined by the capability 143 every time I restart Reactor.
The Siren seems to be doing what it is supposed to do. The volume levels are fine. Should I worry about it?
Reactor version 24302
ZWaveJSController version 24293
Z-Wave JS UI version 9.27.4
zwave-js version 14.3.4
I have the following ACL defined:
groups: admin: users: - admin applications: true api_acls: # This ACL allows users in the "admin" group to access the API - url: "/api" group: admin allow: true log: true # This ACL allows anyone/thing to access the /api/v1/alive API endpoint - url: "/api/v1/alive" allow: trueAnd I have authenticated to MSR as "admin" user. However, I'm getting "access denied" when trying to access http://*******:8111/api/v1/log
So what I'm missing, is my ACL incorrectly defined?
Using build 24302 on Docker.
Hi
I have just connected a bunch of EzloPi controllers to MSR to import some ESP based devices etc.
They all seemed to have worked and imported in to MSR apart from I have one missing device. It is a Digital Gas Sensor device.
This is how that device looks in the Ezlo API.
Devices Info:
_id: "10696001" deviceTypeId: "ezlopi" parentDeviceId: "10696000" category: "level_sensor" subcategory: "" gatewayId: "457a5069" batteryPowered: false name: "Gas Sensor Digital" type: "sensor" reachable: true persistent: true serviceNotification: false armed: false roomId: "" security: "no" ready: true status: "idle" parentRoom: true protectConfig: "default"Items Info:
_id: "20696001" deviceId: "10696001" hasGetter: true hasSetter: false name: "smoke_density" show: true valueType: "substance_amount" scale: "parts_per_million" value: 2.7472610473632812 valueFormatted: "2.75" status: "idle"There is also an Analog Gas sensor that one did import in to MSR OK.
68d63dab-b871-4f44-912b-cf6e0b9eb4c6-image.png
Devices Info:
_id: "10696000" deviceTypeId: "ezlopi" parentDeviceId: "10696000" category: "security_sensor" subcategory: "gas" gatewayId: "457a5069" batteryPowered: false name: "Gas Sensor Analog" type: "sensor" reachable: true persistent: true serviceNotification: false armed: false roomId: "" security: "no" ready: true status: "idle" parentRoom: true protectConfig: "default"Items Info:
_id: "20696000" deviceId: "10696000" hasGetter: true hasSetter: false name: "gas_alarm" show: true valueType: "token" enum: 0: "no_gas" 1: "combustible_gas_detected" 2: "toxic_gas_detected" 3: "unknown" valueFormatted: "no_gas" value: "no_gas" status: "idle"And this is how this MQ2 Gas Sensor looks like on their dashboard:
Digital
cb77dfa3-4af5-4d06-9635-89207a716a89-image.png
Analog
4fb4da1b-e946-4b89-876c-bcd9f5699b6c-image.png
They have an EzloPi website here you can create your own sensor projects using ESP boards, which is very interesting stuff!
And I just wrote on the Ezlo forum here, how to connect an EzloPi controller to MSR.
THANKS.
A couple of things for you @toggledbits, since you mentioned that this release has new features and some tweaks are expected.
Local expressions cannot be deleted. Pushing the X button has no effect for me.
When cloning an entity action, the result is strange (first is cloned one, second is the original action):
a92ea094-9e2c-4aaa-bf47-2d07a6ffdbd0-image.png
When changing the action on the cloned element, the params are added to the original one. See screenshot:
92ac3011-83c8-466b-bd23-47d483ad7a52-image.png
Dark theme has a couple of strange contrasts. One is visible in the previous screenshots (white text on yellow background). Another one is in groups (blue text on blue background):
9b3c4988-53ef-44e6-9672-30e744cacb75-image.png
Overall, I found blue, yellow, red and green (in buttons and forms) to be too bright.
On the bright side:
I love the new script action: thank you! The dark theme is a great start to avoid getting blinded at night I promise I'll try very soon the new features around actions. Thanks!@toggledbits
I just upgraded to version MSR 24293, bare metal running on Fedora. Upon restart, I am getting a error banner:
I followed the new directions about npm
npm i --no-save --no-package-lock --omit dev
Any idea what the issue is?
Seems like switching the UI to the newly added dark mode (thank you for this) does nothing. The UI stays in light mode and only a few buttons turn into dark mode (see screenshot)
Things I have tried:
Hard refresh
Different browser
Different computer
Restarting Reactor
Failed troubleshooting attempts:
No errors in Chrome console
No relevant errors in Reactor log (can still PM the full log file)
Reactor version: latest-24293-ea42a81d
Hardware: Odroid N2+
Linux version: Ubuntu 24.04.1 LTS
3df2806f-9146-485b-9ec1-d056e91cefe5-image.png Dark mode enabled
ff823023-c079-4684-b01f-d6ac6527d31a-image.png Light mode enabled
Good morning,
I have a service MQTT service that needs a restart occasionally. The add-on (Smartbed MQTT) is for the smart bed base for my bed. It has a "safety light" that I can control from HAAS & MSR as a light entity, and also moves the head of the bed to a preset at bedtime, and then lies it back flat in the morning The problem is, from time to time, the light becomes "unavailable" Restarting from the Add-ons tab in HAAS always fixes it, but I should be able to detect when it happens when "light.tempur_pedic_safety_lights" is not true or false, i.e., unavailable.
What I don't know how to do is how to restart that service. Does anybody have experience in restarting add-ons from MSR?
Running:
Reactor (Multi-hub) latest-24212-3ce15e25 ZWaveJSController [0.1.24232]HAAS:
RPi5-64 (8GB) Core 2024.7.3 Supervisor 2024.08.0 Operating System 13.0 Frontend 20240710.0Help updating node.js for bare metal install
-
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.
-
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.
-
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. -
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.
-
@wmarcolin That may have worked, but it's not strictly right and may lead to complications down the road, like versions of
node
andnpm
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 (unlessapt
oryum
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 thePATH
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
andnpm
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 typingnode
). 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 directorynode-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 asroot
) :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'sbin
subdirectory to the current directory (which is our/usr/local/bin
). Thels
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 thePATH
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 thePATH
. 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 doingecho $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 subdirectoriesbin
,lib
andlib/nodejs
within just like we would have in/usr/local
. At this point, the current directory is~/.local/lib/nodejs
, and thewget
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-tar
ing 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 withecho $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 yourPATH
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 correctnode
executable inExecStart
(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 doingwhich node
is only the tip of the iceberg. You need to then dols -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.
-
@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
-
@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.
-
Super thanks for the master class!!!!
-