The Home Assistant Node-RED add-on, recently updated to v19, has moved to node.js v22+ as the base JS engine.
The main Node-RED nodes will support this version, but some contribution nodes will not. In particular @azure/msal-node has been seen to generate this error recently. For some reason something has included a very old version of msal-node which has dependency on the node.js engine as “10 || 12 || 14 || 16 || 18”, rather than something like “>=10”.
This means that, since the installed node.js is now v22 (and also for anyone with v20) npm will not install the node, or will now fall over when trying to update around the node.
Currently msal-node is at version 3.1.0, so 1.18.3 is very old.
So, you must have @azure/msal-node installed in your node_modules directory, and this needs updating. I don’t know but I think that this is not a contrib node but rather a support library that something else has ‘required’.
To find out what module depends on this (ie what got it into your node_modules directory in the first place) you need to run,from the .node-red user directory,
npm list
or
npm list @azure/msal-node
to list dependencies .
Fortunately it seems the NR as an add-on already runs in this directory, hence add an exec node to a flow (with inject and debug) and use the command as follows;
Then all you have to do is go through the result and look for @azure and see what depends on it…
EDIT.
Well, that took some digging.
So, there is a contrib node node-red-contrib-msal, which is over four years since last worked on (see GitHub repository).
And, inside this is the package.json file
And, inside that is the line
"dependencies": {
"@azure/msal-node": "^1.0.1"
which is saying - I need @azure/msal-node, from version 1.0.1.
And, the ^
says “only this major release”, hence anything from 1.0.1 to 1.18.3 (which is probably the very last v1+ before v2 came in).
So, an answer for the brave is to edit this line to
^2.0.1
(which will bring in the last version in v2+ which should support node.js v22)
but of course I have no idea if this will work, so clearly I cannot recommend it.